简体   繁体   中英

how to create a stateless service at runtime on local service fabric server

I'm trying to create instances of stateless services on demand at runtime without additonal entries about types at manifest file.

At the begging I thought, that I can use

using (FabricRuntime fabricRuntime = FabricRuntime.Create())
      {
          fabricRuntime.RegisterServiceType("ServiceType", typeof(Service));
      }

and

ServiceRuntime.RegisterServiceAsync("ServiceType", context => new Service(context)).GetAwaiter().GetResult();

Howerver I still have to register service type or service template at manifest file, but that's beside the point.

Now, I wonder if it is possible to create instance of stateless service without metadata at manifest or powershell scripts? Just write services programmatically?

You probably can, if you use the Docker compose approach. Create containers, instead of Service Fabric applications.

Use the REST api to deploy dynamically generated docker-compose.yml files to create instances.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM