How can a BPMN task determine its REST endpoint prefix?

Hi folks,
I’m looking to differentiate my BPMN’s behavior depending on the REST endpoint to which it is deployed, such as
http://localhost:8080/engine-rest
versus
http://some-other.deploymentlink.myfacility.com/engine-rest

Specifically I’m looking for a method I can use inside a script task. I’ve searched through Camunda Platform Javadocs 7.15.3-ee and have tested things such as getDefaultProcessEngine or getRuntimeService, but none of these give me the specific deployment URL

I’m sure this is available - just can’t find it. Appreciate your collective help!
Dave

Hi @DS_Toledano , could you share a bit more about your use case? Why do you need such behavior?

Hi Victor, the use case involves the same BPMN diagram being deployed to several different Camunda engines. Each deployment environment, in turn, has various external data services available - but the specific database schemas and access methods are different in each deployment server

I could, of course, use separate BPMN’s (harder to maintain) or send in a parameter when instantiating the process to indicate the setup and environment to expect. However I’m thinking that the process might be able to figure this out by itself by determining where it is deployed (e.g. the rest endpoint). Then I’d feed that to a DRM to look up the available options for that deployment environment

@DS_Toledano I wouldn’t be happy on maintaining logic that depends on environments URLs. But, I understand sometimes we just can’t be happy =)

Could you move the pieces depending on those environment specifics to another layer/tier/component?

Ya, if I have to, I will add a microservice that indicates the current setup. Was simply hoping to avoid that

And was also curious if there is, indeed, a way for a process instance to determine where it has been deployed and instantiated. Useful feedback; thanks

@DS_Toledano You could always use InetAddress (Java SE 11 & JDK 11 ) (oracle.com), but I would be very cautious about it.

Yeah that’s true; would provide the server address at least. As you say, handle with care. Thanks!