How to stop/destroy service from container

Posted by Admin on 10-Sep-2008 07:59

public void init(XQInitContext initialContext) throws XQServiceException

{

if(condition = true)

{

Here I want to stop/destrroy the service. Need some suggestion how to achieve this. thanx in advance

}

}

All Replies

Posted by jtownsen on 11-Sep-2008 05:59

The easiest way is to:

throw new XQServiceException("I don't want to start!!");

Posted by Admin on 11-Sep-2008 09:20

I tried throwing XQServiceException in init() method but service still intialized and listening to entry endpoint after throwing exception. Any other suggestion.

thanx

Posted by jtownsen on 11-Sep-2008 09:39

I'm using 7.6 and the service will correctly fail to initialize. This means that start() is never called and therefore the service doesn't consume messages. What version are you using?

Posted by dmillman on 11-Sep-2008 11:50

The other way to do this is to store the exception on the service as state information and basically throw the exception within the service() invocation. As Jaime states this is fully supported out of the box in 7.6

Posted by jtownsen on 11-Sep-2008 14:49

With this approach, any messages placed on the service's Entry Endpoint will get consumed by the service. The unhandled exception (that is deliberately invoked) will move the message to the RME. This may or may not be the behaviour you're looking for. Whether the Entry Endpoint is a topic or a queue might also influence your decision here.

Posted by Admin on 12-Sep-2008 03:32

I am using 7.5.1. Still no success. Even after throwing XQServiceException. Any other suggestion

thanx

This thread is closed