Page History
...
Info |
---|
topshelf 는 개발서비스를 단독 서비스 실행 하는데 도움이되는 툴킷입니다. ( 마이크로 서비스화에 도움이되는 부분요소) 유사한 자바진영 프레임웍 https://www.lightbend.com/lagom-framework https://projects.spring.io/spring-boot/ |
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
using Akka.Actor; using Topshelf; class Program { static void Main(string[] args) { HostFactory.Run(x => { x.Service<MyActorService>(s => { s.ConstructUsing(n => new MyActorService()); s.WhenStarted(service => service.Start()); s.WhenStopped(service => service.Stop()); //continue and restart directives are also available }); x.RunAsLocalSystem(); x.UseAssemblyInfoForServiceInfo(); }); } } /// <summary> /// This class acts as an interface between your application and TopShelf /// </summary> public class MyActorService { private ActorSystem mySystem; public void Start() { //this is where you setup your actor system and other things mySystem = ActorSystem.Create("MySystem"); } public async void Stop() { //this is where you stop your actor system await mySystem.Terminate(); } } |
...