[jbossws-issues] [JBoss JIRA] Updated: (JBWS-1324) JMS Endpoint - Message delivery starts before endpoint is ready.
Darran Lofthouse (JIRA)
jira-events at lists.jboss.org
Mon Nov 12 09:22:44 EST 2007
[ http://jira.jboss.com/jira/browse/JBWS-1324?page=all ]
Darran Lofthouse updated JBWS-1324:
-----------------------------------
Workaround Description:
Add the following code to your endpoint implementation to sleep while waiting for the service endpoint to be ready to process the message: -
@Override
protected SOAPMessage processSOAPMessage(String fromName, InputStream reqMessage) throws SOAPException, IOException,
RemoteException
{
ServiceEndpointManagerFactory factory = ServiceEndpointManagerFactory.getInstance();
ServiceEndpointManager epManager = factory.getServiceEndpointManager();
ObjectName sepID = getServiceEndpointForDestination(epManager, fromName);
ServiceEndpoint sep = epManager.getServiceEndpointByID(sepID);
long startTime = System.currentTimeMillis();
State state = sep.getState();
log.info("State=" + state);
while (state != State.STARTED && (System.currentTimeMillis() - startTime < 60000))
{
try
{
Thread.sleep(1000);
state = sep.getState();
log.info("State=" + state);
}
catch (InterruptedException e)
{
throw new EJBException(e);
}
}
return super.processSOAPMessage(fromName, reqMessage);
}
private ObjectName getServiceEndpointForDestination(ServiceEndpointManager epManager, String fromName)
{
ObjectName sepID = null;
for (ObjectName aux : epManager.getServiceEndpoints())
{
String jmsProp = aux.getKeyProperty("jms");
if (jmsProp != null && jmsProp.equals(fromName))
{
sepID = aux;
break;
}
}
return sepID;
}
was:
Use the barrier controler service and make the message driven bean depend on the server startup being complete. This means that for restarting the server the first message will not be delivered until after everything is deployed.
This workaround does not work for hot redeployments of the bean.
> JMS Endpoint - Message delivery starts before endpoint is ready.
> ----------------------------------------------------------------
>
> Key: JBWS-1324
> URL: http://jira.jboss.com/jira/browse/JBWS-1324
> Project: JBoss Web Services
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: jbossws-jaxws
> Affects Versions: jbossws-1.0.3
> Reporter: Darran Lofthouse
> Fix For: jbossws-2.0.3
>
>
> For most endpoints we need the EJB to be initialised before we initialise the web service, this way we know the session bean will be ready to process requests before the first request from a client is received.
> For message driven beans we need the web service to be initialised before the first message is processed by the MDB, however the same logic is used as is used for session beans so it is possible that the first message will be received while the web service is still being initialised.
> 12:53:51,277 ERROR [SOAPFaultHelperJAXRPC] SOAP request exception
> javax.xml.rpc.soap.SOAPFaultException: Endpoint cannot handle requests in state: CREATED
> at org.jboss.ws.core.server.ServiceEndpoint.processRequest(ServiceEndpoint.java:176)
> at org.jboss.ws.integration.jboss42.jms.JMSMessageDispatcher.dipatchMessage(JMSMessageDispatcher.java:94)
> at org.jboss.ws.integration.jboss42.jms.JMSTransportSupport.processSOAPMessage(JMSTransportSupport.java:139)
> at org.jboss.ws.integration.jboss42.jms.JMSTransportSupport.onMessage(JMSTransportSupport.java:101)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.jboss.invocation.Invocation.performCall(Invocation.java:359)
> at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:495)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jbossws-issues
mailing list