activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fhenskens <fhensk...@yahoo.com>
Subject Topics working, queues aren't
Date Wed, 18 Oct 2017 06:31:08 GMT
Hi,

I'm using ActiveMQ 5.14.3 in TomEE 7.0.3

I've migrated an old EE app from weblogic to TomEE.

The Topic setup is working perfectly, including message selectors and
forwarding between topics.

Debugging, the queue isn't exceptioning out when sending messages, however
the consumer isn't actually consuming anything.

Here are some appropriate code sections:

>From Command.java (implements serializable)

    public synchronized void queue( final InitialContext context, final
boolean postpone ) throws JMSException,
                                                                               
NamingException
    {
        final ConnectionFactory connectionFactory =
            (ConnectionFactory)Application.getInitialContext().lookup(
                "openejb:Resource/JmsConnectionFactory" );
        final Connection connection = connectionFactory.createConnection();
        connection.start();
        final Session session =
            connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

        final Queue commandQueue =
            (Queue)Application.getInitialContext().lookup(
                "openejb:Resource/CommandQueue" );
        final MessageProducer sender = session.createProducer(commandQueue);
        final ObjectMessage message = session.createObjectMessage(this);
        if ( postpone )
        {
            message.setLongProperty(
                ScheduledMessage.AMQ_SCHEDULED_DELAY,
                getRetryIntervalMinutes() * 60000 );
        }
        sender.send( message );
        try { sender.close(); } catch ( final Exception e ) {}
        try { session.close(); } catch ( final Exception e ) {}
        try { connection.close(); } catch ( final Exception e ) {}
    }

>From CommandExecutorMDB:

@MessageDriven(name = "CommandExecutorMDB", activationConfig = {
        @ActivationConfigProperty(propertyName = "destinationType",
propertyValue = "javax.jms.Queue"),
        @ActivationConfigProperty(propertyName = "destination",
propertyValue = "CommandQueue"),
        @ActivationConfigProperty(propertyName = "acknowledgeMode",
propertyValue = "Auto-acknowledge") })
@LocalClient
public class CommandExecutorMDB implements MessageListener
{
    @Resource
    private ConnectionFactory myConnectionFactory;

    @Resource( name="CommandQueue" )
    private Queue myCommandQueue;

    /* (non-Javadoc)
     * @see javax.jms.MessageListener#onMessage(javax.jms.Message)
     */
    @Override
    public void onMessage( final Message msg )
    {
        try
        {
            Command command = null;

            // We got a message, try to read it
            try
            {
                command = Command.read( msg );
                if ( command == null )
                {
                    throw new Exception(
                        "Null message received on command queue" );
                }
            }
            catch ( final Exception e )
            {
                DefaultLog.getDefaultLog().logError( "Error reading message
from JMS queue. Committing the transaction and trying again.", e );
            }

            // attempt the command.
            command.attempt( Application.getInitialContext() );
        }
        catch ( final Exception e )
        {
            DefaultLog.getDefaultLog().logError( "Internal error while
attempting Command. ", e );
        }
    }
}

Debugging shows a successful step-through of Command, sending without
exception. CommandExecutorMDB's onMessage method is never entered.

Any ideas how I stuffed it up?



--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html

Mime
View raw message