How to get end point name inside a service

Posted by smahanta on 10-Nov-2009 03:08

I have a sonic service - say by name MyService. Now in the init method of the service I want to know what is the entry end point for the said service.Let the entry end point be MyService.Entry.This end point represents a queue of the same name.init method takes XQInitContext as argument. From that we can get

XQParameters XQParameters params = initialContext.getParameters();

From params I tried to get entry point name as :

String entryEndPointAddress = 

But this is not working as I am getting null.

Pl. help.



All Replies

Posted by Bill Wood on 11-Nov-2009 14:01

The Entry Endpoint is an ObjectParameter, not a String Parameter.  Setting the type to "String" is not casting this as a string, it is looking for a String parameter with this name (and none exists -- so you get 'null').

What you want is something like:

private XQEndpointConfig getEntryEPConfig(XQInitContext xqContext) 
    throws NamingException, Exception
    XQParameters params = initContext.getParameters();
    XQAddress entryEndpoint =
          (XQAddress) params.getParameterObject(XQConstants.SERVICE_PARAM_ENTRY_ENDPOINT_ADDRESS,
    if (entryEndpoint == null)
        throw new Exception("null-entryep");
    // This will get the Entry Endpoint Name
    String entryEPName = IConfigConstants.ENDPOINT + '/' + entryEndpoint.getName();
    return (XQEndpointConfig) m_initialContext.lookup(entryEPName);

This thread is closed