service-fabric icon indicating copy to clipboard operation
service-fabric copied to clipboard

How to pass data to guest executable at runtime?

Open nabeelrehman2114 opened this issue 7 years ago • 7 comments

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??

nabeelrehman2114 avatar Feb 14 '18 10:02 nabeelrehman2114

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?

xunlu avatar Feb 20 '18 00:02 xunlu

Environment Variables also work

masnider avatar Feb 27 '18 02:02 masnider

@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 .

nabeelrehman2114 avatar Feb 27 '18 05:02 nabeelrehman2114

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.

RajeetN avatar Feb 27 '18 05:02 RajeetN

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.

nabeelrehman2114 avatar Feb 27 '18 05:02 nabeelrehman2114

@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

usamaazhar avatar Feb 27 '18 05:02 usamaazhar

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.

RajeetN avatar Feb 27 '18 06:02 RajeetN