Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.2
  • Fix Version/s: 1.3-rc2
  • Component/s: Core: Containers
  • Labels:
    None
  • Environment:

    Windows XP, Java SDK1.4.2, Spring 1.2.4, ActiveMQ 3.2

  • Configuration:
    Hide

    Using Spring AutowireUMOManagerFactoryBean

    Show
    Using Spring AutowireUMOManagerFactoryBean
  • Log Output:
    Hide
    2005-12-15 19:11:28,811 INFO org.mule.providers.jms.JmsConnector(790) - Connected: org.mule.providers.jms.JmsConnector@2200d5
    2005-12-15 19:11:28,811 INFO org.mule.providers.jms.JmsConnector(254) - Starting Connector: org.mule.providers.jms.JmsConnector
    2005-12-15 19:11:28,821 INFO org.activemq.ActiveMQConnection(1309) - channel status changed: Channel: TcpTransportChannel: Socket[addr=localhost/127.0.0.1,port=61616,localport=1743] has connected
    2005-12-15 19:11:28,831 INFO org.mule.providers.jms.JmsConnector(266) - Connector: org.mule.providers.jms.JmsConnector has been started
    2005-12-15 19:11:28,831 INFO org.mule.providers.file.FileConnector(790) - Connected: org.mule.providers.file.FileConnector@17e121c
    2005-12-15 19:11:28,831 INFO org.mule.providers.file.FileConnector(254) - Starting Connector: org.mule.providers.file.FileConnector
    2005-12-15 19:11:28,831 INFO org.mule.providers.file.FileConnector(266) - Connector: org.mule.providers.file.FileConnector has been started
    2005-12-15 19:11:28,831 INFO org.mule.providers.http.HttpConnector(790) - Connected: org.mule.providers.http.HttpConnector@3b8b49
    2005-12-15 19:11:28,831 INFO org.mule.providers.http.HttpConnector(254) - Starting Connector: org.mule.providers.http.HttpConnector
    2005-12-15 19:11:28,831 INFO org.mule.providers.http.HttpConnector(266) - Connector: org.mule.providers.http.HttpConnector has been started
    2005-12-15 19:11:28,831 INFO org.mule.MuleManager(769) - Connectors have been started successfully
    2005-12-15 19:11:28,831 INFO org.mule.MuleManager(1078) - Starting agents...
    2005-12-15 19:11:28,841 INFO org.mule.MuleManager(1081) - Starting agent: Mule Admin: accepting connections on tcp://localhost:60504
    2005-12-15 19:11:28,841 INFO org.mule.MuleManager(1085) - Agents Successfully Started
    2005-12-15 19:11:28,861 INFO org.mule.impl.model.seda.SedaModel(365) - Component MyUMO has been started successfully
    2005-12-15 19:11:28,861 INFO org.mule.providers.http.HttpConnector(507) - registering listener: pbsUMO on endpointUri: http://localhost:8888
    2005-12-15 19:11:28,881 INFO org.mule.providers.http.HttpMessageReceiver(361) - Successfully connected to: http://localhost:8888
    2005-12-15 19:11:28,881 INFO org.mule.impl.model.seda.SedaModel(365) - Component pbsUMO has been started successfully
    2005-12-15 19:11:28,881 INFO org.mule.providers.tcp.TcpConnector(507) - registering listener: _muleManagerComponent on endpointUri: tcp://localhost:60504
    2005-12-15 19:11:28,881 INFO org.mule.providers.tcp.TcpMessageReceiver(361) - Successfully connected to: tcp://localhost:60504
    2005-12-15 19:11:28,961 INFO org.mule.impl.model.seda.SedaModel(365) - Component _muleManagerComponent has been started successfully
    2005-12-15 19:11:28,961 INFO org.mule.providers.jms.JmsConnector(507) - registering listener: pbaUMO on endpointUri: jms://request
    2005-12-15 19:11:29,022 INFO org.mule.providers.jms.JmsMessageReceiver(361) - Successfully connected to: jms://request
    2005-12-15 19:11:29,082 ERROR org.mule.impl.DefaultExceptionStrategy(231) -
    ********************************************************************************
    Message : Cannot route event as component "pbaUMO" is stopped. Connector that caused exception is: pbaUMO. Message payload is of type: org.activemq.message.ActiveMQTextMessage
    Type : org.mule.umo.ComponentException
    Code : 79999
    JavaDoc : http://mule.codehaus.org/docs/apidocs/org/mule/umo/ComponentException.html
    Payload : ACTIVEMQ_TEXT_MESSAGE: id = <snipped>
    ********************************************************************************
    Exception stack is:
    1. Cannot route event as component "pbaUMO" is stopped. Connector that caused exception is: pbaUMO. Message payload is of type: org.activemq.message.ActiveMQTextMessage (org.mule.umo.ComponentException)
      org.mule.impl.model.AbstractComponent:228 (http://mule.codehaus.org/docs/apidocs/org/mule/umo/ComponentException.html)
    ********************************************************************************
    Root Exception stack trace:
    org.mule.umo.ComponentException: Cannot route event as component "pbaUMO" is stopped. Connector that caused exception is: pbaUMO. Message payload is of type: org.activemq.message.ActiveMQTextMessage
            at org.mule.impl.model.AbstractComponent.dispatchEvent(AbstractComponent.java:228)
            at org.mule.impl.MuleSession.dispatchEvent(MuleSession.java:160)
            at org.mule.routing.inbound.InboundMessageRouter.dispatch(InboundMessageRouter.java:146)
            at org.mule.routing.inbound.InboundMessageRouter.route(InboundMessageRouter.java:126)
            at org.mule.providers.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:486)
            at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:277)
            at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:231)
            at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:225)
            at org.mule.providers.jms.JmsMessageReceiver.onMessage(JmsMessageReceiver.java:101)
            at org.activemq.ActiveMQMessageConsumer.processMessage(ActiveMQMessageConsumer.java:449)
            at org.activemq.ActiveMQMessageConsumer.setMessageListener(ActiveMQMessageConsumer.java:246)
            at org.mule.providers.jms.JmsMessageReceiver.doStart(JmsMessageReceiver.java:109)
            at org.mule.providers.AbstractMessageReceiver.start(AbstractMessageReceiver.java:399)
            at org.mule.providers.AbstractConnector.registerListener(AbstractConnector.java:518)
            at org.mule.impl.model.AbstractModel.registerListeners(AbstractModel.java:229)
            at org.mule.impl.model.AbstractModel.start(AbstractModel.java:362)
            at org.mule.MuleManager.start(MuleManager.java:730)
    Show
    2005-12-15 19:11:28,811 INFO org.mule.providers.jms.JmsConnector(790) - Connected: org.mule.providers.jms.JmsConnector@2200d5 2005-12-15 19:11:28,811 INFO org.mule.providers.jms.JmsConnector(254) - Starting Connector: org.mule.providers.jms.JmsConnector 2005-12-15 19:11:28,821 INFO org.activemq.ActiveMQConnection(1309) - channel status changed: Channel: TcpTransportChannel: Socket[addr=localhost/127.0.0.1,port=61616,localport=1743] has connected 2005-12-15 19:11:28,831 INFO org.mule.providers.jms.JmsConnector(266) - Connector: org.mule.providers.jms.JmsConnector has been started 2005-12-15 19:11:28,831 INFO org.mule.providers.file.FileConnector(790) - Connected: org.mule.providers.file.FileConnector@17e121c 2005-12-15 19:11:28,831 INFO org.mule.providers.file.FileConnector(254) - Starting Connector: org.mule.providers.file.FileConnector 2005-12-15 19:11:28,831 INFO org.mule.providers.file.FileConnector(266) - Connector: org.mule.providers.file.FileConnector has been started 2005-12-15 19:11:28,831 INFO org.mule.providers.http.HttpConnector(790) - Connected: org.mule.providers.http.HttpConnector@3b8b49 2005-12-15 19:11:28,831 INFO org.mule.providers.http.HttpConnector(254) - Starting Connector: org.mule.providers.http.HttpConnector 2005-12-15 19:11:28,831 INFO org.mule.providers.http.HttpConnector(266) - Connector: org.mule.providers.http.HttpConnector has been started 2005-12-15 19:11:28,831 INFO org.mule.MuleManager(769) - Connectors have been started successfully 2005-12-15 19:11:28,831 INFO org.mule.MuleManager(1078) - Starting agents... 2005-12-15 19:11:28,841 INFO org.mule.MuleManager(1081) - Starting agent: Mule Admin: accepting connections on tcp://localhost:60504 2005-12-15 19:11:28,841 INFO org.mule.MuleManager(1085) - Agents Successfully Started 2005-12-15 19:11:28,861 INFO org.mule.impl.model.seda.SedaModel(365) - Component MyUMO has been started successfully 2005-12-15 19:11:28,861 INFO org.mule.providers.http.HttpConnector(507) - registering listener: pbsUMO on endpointUri: http://localhost:8888 2005-12-15 19:11:28,881 INFO org.mule.providers.http.HttpMessageReceiver(361) - Successfully connected to: http://localhost:8888 2005-12-15 19:11:28,881 INFO org.mule.impl.model.seda.SedaModel(365) - Component pbsUMO has been started successfully 2005-12-15 19:11:28,881 INFO org.mule.providers.tcp.TcpConnector(507) - registering listener: _muleManagerComponent on endpointUri: tcp://localhost:60504 2005-12-15 19:11:28,881 INFO org.mule.providers.tcp.TcpMessageReceiver(361) - Successfully connected to: tcp://localhost:60504 2005-12-15 19:11:28,961 INFO org.mule.impl.model.seda.SedaModel(365) - Component _muleManagerComponent has been started successfully 2005-12-15 19:11:28,961 INFO org.mule.providers.jms.JmsConnector(507) - registering listener: pbaUMO on endpointUri: jms://request 2005-12-15 19:11:29,022 INFO org.mule.providers.jms.JmsMessageReceiver(361) - Successfully connected to: jms://request 2005-12-15 19:11:29,082 ERROR org.mule.impl.DefaultExceptionStrategy(231) - ******************************************************************************** Message : Cannot route event as component "pbaUMO" is stopped. Connector that caused exception is: pbaUMO. Message payload is of type: org.activemq.message.ActiveMQTextMessage Type : org.mule.umo.ComponentException Code : 79999 JavaDoc : http://mule.codehaus.org/docs/apidocs/org/mule/umo/ComponentException.html Payload : ACTIVEMQ_TEXT_MESSAGE: id = <snipped> ******************************************************************************** Exception stack is: 1. Cannot route event as component "pbaUMO" is stopped. Connector that caused exception is: pbaUMO. Message payload is of type: org.activemq.message.ActiveMQTextMessage (org.mule.umo.ComponentException)   org.mule.impl.model.AbstractComponent:228 (http://mule.codehaus.org/docs/apidocs/org/mule/umo/ComponentException.html) ******************************************************************************** Root Exception stack trace: org.mule.umo.ComponentException: Cannot route event as component "pbaUMO" is stopped. Connector that caused exception is: pbaUMO. Message payload is of type: org.activemq.message.ActiveMQTextMessage         at org.mule.impl.model.AbstractComponent.dispatchEvent(AbstractComponent.java:228)         at org.mule.impl.MuleSession.dispatchEvent(MuleSession.java:160)         at org.mule.routing.inbound.InboundMessageRouter.dispatch(InboundMessageRouter.java:146)         at org.mule.routing.inbound.InboundMessageRouter.route(InboundMessageRouter.java:126)         at org.mule.providers.AbstractMessageReceiver$DefaultInternalMessageListener.onMessage(AbstractMessageReceiver.java:486)         at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:277)         at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:231)         at org.mule.providers.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:225)         at org.mule.providers.jms.JmsMessageReceiver.onMessage(JmsMessageReceiver.java:101)         at org.activemq.ActiveMQMessageConsumer.processMessage(ActiveMQMessageConsumer.java:449)         at org.activemq.ActiveMQMessageConsumer.setMessageListener(ActiveMQMessageConsumer.java:246)         at org.mule.providers.jms.JmsMessageReceiver.doStart(JmsMessageReceiver.java:109)         at org.mule.providers.AbstractMessageReceiver.start(AbstractMessageReceiver.java:399)         at org.mule.providers.AbstractConnector.registerListener(AbstractConnector.java:518)         at org.mule.impl.model.AbstractModel.registerListeners(AbstractModel.java:229)         at org.mule.impl.model.AbstractModel.start(AbstractModel.java:362)         at org.mule.MuleManager.start(MuleManager.java:730)
  • Similar Issues:
    None

Description

The AbstractModel code registers a listener (i.e. a component) with an endpoint prior to starting the component. If the endpoint is a JMS queue, and the queue contains existing messages then those messages are sent to the component before it has had a chance to start up.

In the log output provided, the component 'pbaUMO' successfully connects to the jms endpoint 'jms://request' - but this jms queue contains existing messages and a message is received before the 'pbaUMO' is started (and consumed unsuccessfully).

Would it be an improvement to start the component first and then register it as a listener when it is ready to accept events?

Activity

Hide
Ben Anderson added a comment -

Making the following modification to AbstractModel.start() appears to resolve my particular issue...

public void start() throws UMOException
{
if (!initialised.get()) { initialise(); }

if (!started.get()) {
fireEvent(new ModelEvent(this, ModelEvent.MODEL_STARTING));

for (Iterator i = components.values().iterator(); i.hasNext() {
UMOComponent temp = (UMOComponent) i.next();
// registerListeners(temp); <--- THIS LINE MOVED FROM HERE
if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_STARTED)) { temp.start(); logger.info("Component " + temp + " has been started successfully"); // <---- COULD POSSIBLY GO HERE } else if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_PAUSED)) { temp.start(); temp.pause(); logger.info("Component " + temp + " has an initial state of 'paused'"); } else { logger.info("Component " + temp + " has an initial state of 'stopped'"); }
registerListeners(temp); // MOVED TO HERE FOR NOW

}
started.set(true);
fireEvent(new ModelEvent(this, ModelEvent.MODEL_STARTED));
} else { logger.debug("Model already started"); }
}

Strictly speaking the listeners should probably only be registered if the component has an initial state of started but I haven't investigated the side effects of doing this.

Ben

Show
Ben Anderson added a comment - Making the following modification to AbstractModel.start() appears to resolve my particular issue... public void start() throws UMOException { if (!initialised.get()) { initialise(); } if (!started.get()) { fireEvent(new ModelEvent(this, ModelEvent.MODEL_STARTING)); for (Iterator i = components.values().iterator(); i.hasNext() { UMOComponent temp = (UMOComponent) i.next(); // registerListeners(temp); <--- THIS LINE MOVED FROM HERE if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_STARTED)) { temp.start(); logger.info("Component " + temp + " has been started successfully"); // <---- COULD POSSIBLY GO HERE } else if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_PAUSED)) { temp.start(); temp.pause(); logger.info("Component " + temp + " has an initial state of 'paused'"); } else { logger.info("Component " + temp + " has an initial state of 'stopped'"); } registerListeners(temp); // MOVED TO HERE FOR NOW } started.set(true); fireEvent(new ModelEvent(this, ModelEvent.MODEL_STARTED)); } else { logger.debug("Model already started"); } } Strictly speaking the listeners should probably only be registered if the component has an initial state of started but I haven't investigated the side effects of doing this. Ben
Hide
Travis Carlson added a comment -

Ben, this issue has already been fixed in CVS (see http://jira.symphonysoft.com/browse/MULE-494) with a patch very similar to the one you suggest.

Show
Travis Carlson added a comment - Ben, this issue has already been fixed in CVS (see http://jira.symphonysoft.com/browse/MULE-494) with a patch very similar to the one you suggest.
Hide
Ben Anderson added a comment -

Ok thanks - I thought my situation may have been slightly different in that my components always had their initial state set to 'started' and not 'stopped'. If the patch handles both situations and does things in the correct sequence then great! I'll check it out.

Show
Ben Anderson added a comment - Ok thanks - I thought my situation may have been slightly different in that my components always had their initial state set to 'started' and not 'stopped'. If the patch handles both situations and does things in the correct sequence then great! I'll check it out.
Hide
Travis Carlson added a comment -

Hmm, looking at this again, your're right, this issue is a little bit different. Could you attach your mule configuration file so we can make a test case for this?

Show
Travis Carlson added a comment - Hmm, looking at this again, your're right, this issue is a little bit different. Could you attach your mule configuration file so we can make a test case for this?
Hide
Ben Anderson added a comment -

Ok - i'll see what I can provide (without getting myself in trouble). We're not using the standard Mule configuration file - we're using a modded version of the AutowireUMOManagerFactory (the observed behaviour also happens under the AutowireUMOManagerFactory that ships with Mule).

Show
Ben Anderson added a comment - Ok - i'll see what I can provide (without getting myself in trouble). We're not using the standard Mule configuration file - we're using a modded version of the AutowireUMOManagerFactory (the observed behaviour also happens under the AutowireUMOManagerFactory that ships with Mule).
Hide
Ross Mason added a comment -

whats the status on this issue?

Show
Ross Mason added a comment - whats the status on this issue?
Hide
Travis Carlson added a comment -

Well, the current code (from org.mule.impl.model.AbstractModel.start) is:

if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_STARTED)) { registerListeners(temp); temp.start(); logger.info("Component " + temp + " has been started successfully"); } else if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_PAUSED)) { registerListeners(temp); temp.start(); temp.pause(); logger.info("Component " + temp + " has an initial state of 'paused'"); } else { logger.info("Component " + temp + " has an initial state of 'stopped'"); }

The issue would be fixed by making the following change:

if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_STARTED)) { > temp.start(); > registerListeners(temp); logger.info("Component " + temp + " has been started successfully"); } else if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_PAUSED)) { > temp.start(); > temp.pause(); > registerListeners(temp); logger.info("Component " + temp + " has an initial state of 'paused'"); } else { logger.info("Component " + temp + " has an initial state of 'stopped'"); } }

However, without a good test case, I would be wary of creating unwanted side effects so close to the 1.3 release...

Show
Travis Carlson added a comment - Well, the current code (from org.mule.impl.model.AbstractModel.start) is: if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_STARTED)) { registerListeners(temp); temp.start(); logger.info("Component " + temp + " has been started successfully"); } else if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_PAUSED)) { registerListeners(temp); temp.start(); temp.pause(); logger.info("Component " + temp + " has an initial state of 'paused'"); } else { logger.info("Component " + temp + " has an initial state of 'stopped'"); } The issue would be fixed by making the following change: if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_STARTED)) { > temp.start(); > registerListeners(temp); logger.info("Component " + temp + " has been started successfully"); } else if(temp.getDescriptor().getInitialState().equals(ImmutableMuleDescriptor.INITIAL_STATE_PAUSED)) { > temp.start(); > temp.pause(); > registerListeners(temp); logger.info("Component " + temp + " has an initial state of 'paused'"); } else { logger.info("Component " + temp + " has an initial state of 'stopped'"); } } However, without a good test case, I would be wary of creating unwanted side effects so close to the 1.3 release...
Hide
Jesus Menenedez added a comment -

Well, apparently you have created one unwanted issue.

I have a MuleEventMulticaster component with a subscription to a glue endpoint.

The problem is that the registerListeners method is used to add the initialisationCallbacks to the muleEventMulticasterDescriptor.
The GlueGlueInitialisationCallback is added at that point. This GlueInitialisationCallback is the one that publishes the mule bean to the glue HTTP server.

Because you have changed the order, by starting the component before, there is not GlueInitialisationCallback added yet when the component is started, so no component is published.

It might no make sense, but the inmediate result of that change is that glue endpoints are not published to the glue HTTP server.

Show
Jesus Menenedez added a comment - Well, apparently you have created one unwanted issue. I have a MuleEventMulticaster component with a subscription to a glue endpoint. The problem is that the registerListeners method is used to add the initialisationCallbacks to the muleEventMulticasterDescriptor. The GlueGlueInitialisationCallback is added at that point. This GlueInitialisationCallback is the one that publishes the mule bean to the glue HTTP server. Because you have changed the order, by starting the component before, there is not GlueInitialisationCallback added yet when the component is started, so no component is published. It might no make sense, but the inmediate result of that change is that glue endpoints are not published to the glue HTTP server.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: