How to configure dynamic endpoints for a service/process?

Posted by nithinonpsdn on 11-Jun-2010 07:58

I have an itinerary for which i need to configure endpoints dynamically. Pls help me with the how-to-dos.

All Replies

Posted by sk185050 on 11-Jun-2010 08:03

Try with the cbr or xcbr.

Posted by nithinonpsdn on 11-Jun-2010 10:56

Hi I do not mean in the CBR way.

I do not want to hardcode the endpoints while we develop the service. I want the service to pickup its corresponding end-point dynamically post deployment.

Posted by Bill Wood on 12-Jun-2010 05:17

The code to do this is basically as follows  You would add this code to your start() method

  XQEndpoint ep = mgr.getEndpoint(strName);

  if(ep != null)

  {

     m_xqLog.logInformation("Registering Entry endpoint : " + strName);

     mgr.registerAsEntryEndpoint(ep, 1);

  }

Posted by nithinonpsdn on 12-Jun-2010 09:56

Thanks William. Can you please tell me where do I find the start() method?.

Should I make a java service type? Pls help me in this regard.

After having thsi code snippet in place, where should I give my dynamic endpoint so that it can be identified and taken by the service.

Please elaborate on this.

Posted by tsteinbo on 14-Jun-2010 07:21

The start method is something you can implement if your java service type does not just implement XQService but XQServiceEx. For the latter you now also have start and stop callbacks from the ESB container.

If you use the snippet in that method you can register extra (entry) endpoints as well for you service.

Thomas

Posted by Bill Wood on 14-Jun-2010 07:27

Would you mind sharing your exact use case.   The Dynaminc Endpont for a service is really an advanced feature usually used when you need to get some replies or data back to a specific instance of a service (when multiple are deployed) -- that is, they'd all have the same 'Entry' but each instance has a dedicated channel.

For most cases, if you want a servcie to listen to some different place that you only know after deployment, then you change the definition of the Entry Endpoint itself administratively.

Typically, if you want to listen for different events that are dynamic, you'd do that in a JMS layer and then dispatch messages to the known Entry Endpoint of the Process or Service.  

Posted by nithinonpsdn on 14-Jun-2010 08:34

Thanks Thomas.

Posted by nithinonpsdn on 14-Jun-2010 08:38

I do not have a use-case as such now. But i developed a service and later felt like externalizing the Endpoints so that in the future if there is any change in the endpoint name or type (from queue to topic and vice versa) I should not face the need to retake the deployed service and change the endpoint and then redeploy it. I am just researching on it but could not find it out.

Posted by tsteinbo on 14-Jun-2010 08:48

That sounds like you want to tailor the type/name of the endpoints at deployment time (but not runtime).

For that we provide your with the tailoring map feature (see e.g. esbadmin and applyMap/createMap). It allows you to provide new values during the upload to the target directory service.

Thomas

Posted by nithinonpsdn on 14-Jun-2010 09:49

Thanks Thomas.

Do we have sonic documents regarding Map feature?

Moreover if I wanna do it at runtime which is post-deployment how should I go about it?

I mean that I donot want to go back to the deployed service if there is any change in the endpoint names/type after the service is up and running in the target

environment? Please help me in this regard.

Posted by tsteinbo on 14-Jun-2010 10:07

All documentation is accesible from javascript:; Pick the product version you need and then choose the Deployment Guide.

At true runtime (e.g. the service is running) you would have to revert to the properties files and dynamic endpoints as already disucssed. If it is just a change though that needs to be in effect after a service restart changing it in ESB Explorer might just be enough.

Posted by nithinonpsdn on 14-Jun-2010 10:37

Thank you Thomas.

Posted by nithinonpsdn on 15-Jun-2010 03:36

Hi Thomas,

    Can you please let me know where I can find info about the Properties file for configuring Dynamic endpoints at true runtime?

Posted by Bill Wood on 15-Jun-2010 06:17

nithinonpsdn wrote:

...

    Can you please let me know where I can find info about the Properties file for configuring Dynamic endpoints at true runtime?

Using a properties file is not a product feature (directly).  It is code you'd write to manage the Endpoint creation.  (You'd put the property file in SonicFS and then read it with a URLConnection object (e.g. sonicfs://myconfigs/ABC_Entry.properties).

However, writing the values to a properties file and then uploading it to the DS just gives you the same behavior as modifying the entry endpoint definition.  For your use case, just modify the Entry endpoint itself.   You can do this directly in tooling (SMC), as a script in ESBAdmin, or using the Deploy tool.

Posted by nithinonpsdn on 15-Jun-2010 07:55

Thanks William

This thread is closed