service-fabric
service-fabric copied to clipboard
How to pass data to guest executable at runtime?
I have a stateless service that spin up a new guest executable on demand.I need to pass some data at service creation time to guest executable. How can i do that??
https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-deploy-existing-app#overview-of-application-and-service-manifest-files
Have you read this?
Environment Variables also work
@xunlu yes already tried Entrypoint and setupEntrypoint. but problem is that they are used to pass hardcoded data. i am using StatelessServiceDescription serviceDescription = new StatelessServiceDescription() { ApplicationName = new Uri(m_appName), InstanceCount = 1, PartitionSchemeDescription = new SingletonPartitionSchemeDescription(), ServiceTypeName = serviceType, ServiceName = new Uri(serviceName), ServicePackageActivationMode = ServicePackageActivationMode.ExclusiveProcess }; and then await m_fabricClient.ServiceManager.CreateServiceAsync(serviceDescription); to create a new guest executable service at run time from a stateful reliable service. now i have 100's of guest executable services and i have to pass different data to each service 1)i cannot use Entrypoint and setupEntrypoint 2)cannot set environment variable of one service from another @masnider .
How big is the data you want to pass? You can create a new application+Service pair and pass environment variables via ApplicationParameters to override the values when new app is created.
Each guest executable works on a unique file it downloads from cloud and we have to provide path of that file and also directory structure where it will be saved on local disk. application+Service is not an option here.
@RajeetN Does creating a new application for each service follow the micro-services guidelines for service fabric ? I mean the Gist is to have multiple micro-services in a single application
SF doesn't have control over how guest executable consumes data so doesn't have mechanism for this. You can create a stateless service and pass the data as initialization parameter to it.