activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From swift99 <djohn...@maxistechnology.com>
Subject ActiveMQ / JMS “losing” messages - what am I missing?
Date Wed, 09 Mar 2016 20:11:27 GMT
What am I missing?

This is cross-posted from
http://stackoverflow.com/questions/35896002/activemq-jms-losing-messages-what-am-i-missing.

AMQ version 5.13.2 
Java 1.8.0_74 
Windows 10
transportConnector uri="vm://localhost"

Given a simple test case, two Object messages are transmitted, one with data
and the other being an end-of-data marker. Only the end-of-data marker is
being received.

The queue is created at the beginning of the job, and destroyed after the
job completes.

If I run a larger number of transactions, I see about a 50% receive rate.

The logs clearly show that the receiver was started before the first message
was put on the queue, both messages are being put on the queue, but only the
second message is actually being received.

Both the sender and receiver are on the same JVM. Each has its own Session
and Connection.

Transmit code:

    private void doSomeStuffInTransaction (final Object model) {
        transactionTemplate.execute(new TransactionCallbackWithoutResult() {
            @Override
            protected void doInTransactionWithoutResult(TransactionStatus
status) {
                try {
                    doSomeStuff ( model );

                    ObjectMessage message = session.createObjectMessage(
                            (model.getRoot() == null)
                            ? null
                            : model.getRoot().getContents().getId());
                    messageProducer.send(message);
                    logger.debug("Sent: {}", message.toString());
                }catch (Exception e) {
                      //use this to rollback exception in case of exception
                    status.setRollbackOnly();
                    throw new RuntimeException(e.getmessage(), e);
                }   

            }});
    }   
Receiver code:

public Object read() throws Exception,
        UnexpectedInputException, ParseException,
        NonTransientResourceException {

    Object result = null;

    logger.debug("Attempting to receive message on connection: ",
connection.toString());

    ObjectMessage msg = (ObjectMessage) messageConsumer.receive();
    logger.debug("Received: {}", msg.toString());
    result = msg.getObject();

    return result;
}


Log snip:

DEBUG com.mylib.SelectedDataJmsReader - Attempting to receive message on
connection: 
... snip ...
DEBUG com.mylib.SelectedDataJmsWriter - Sent: ActiveMQObjectMessage
{commandId = 0, responseRequired = false, messageId =
ID:zip-51438-1457536143607-4:1:5:1:1, originalDestination = null,
originalTransactionId = null, producerId = null, destination =
queue://Workorders via SQL.383, transactionId = null, expiration = 0,
timestamp = 1457536412608, arrival = 0, brokerInTime = 0, brokerOutTime = 0,
correlationId = null, replyTo = null, persistent = true, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content =
org.apache.activemq.util.ByteSequence@3c21d3e0, marshalledProperties = null,
dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
readOnlyProperties = false, readOnlyBody = false, droppable = false,
jmsXGroupFirstForConsumer = false}
INFO  com.mylib.SelectedDataJmsWriter - Committed 1 hierarchies to redo log
and JMS queue
INFO  com.mylib.SourceSelectionReaderImpl - Returning empty treemodel and
end-of-stream placeholder.
DEBUG com.mylib.SelectedDataJmsWriter - Sent: ActiveMQObjectMessage
{commandId = 0, responseRequired = false, messageId =
ID:zip-51438-1457536143607-4:1:5:1:2, originalDestination = null,
originalTransactionId = null, producerId = null, destination =
queue://Workorders via SQL.383, transactionId = null, expiration = 0,
timestamp = 1457536412696, arrival = 0, brokerInTime = 0, brokerOutTime = 0,
correlationId = null, replyTo = null, persistent = true, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content = null, marshalledProperties =
null, dataStructure = null, redeliveryCounter = 0, size = 0, properties =
null, readOnlyProperties = false, readOnlyBody = false, droppable = false,
jmsXGroupFirstForConsumer = false}
INFO  com.mylib.SelectedDataJmsWriter - Committed 1 hierarchies to redo log
and JMS queue
DEBUG com.mylib.SelectedDataJmsReader - Received: ActiveMQObjectMessage
{commandId = 19, responseRequired = true, messageId =
ID:zip-51438-1457536143607-4:1:5:1:2, originalDestination = null,
originalTransactionId = null, producerId =
ID:zip-51438-1457536143607-4:1:5:1, destination = queue://Workorders via
SQL.383, transactionId = null, expiration = 0, timestamp = 1457536412696,
arrival = 0, brokerInTime = 1457536412696, brokerOutTime = 1457536412697,
correlationId = null, replyTo = null, persistent = true, type = null,
priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
compressed = false, userID = null, content = null, marshalledProperties =
null, dataStructure = null, redeliveryCounter = 0, size = 1024, properties =
null, readOnlyProperties = true, readOnlyBody = true, droppable = false,
jmsXGroupFirstForConsumer = false}
INFO  com.mylib.SelectedDataJmsReader - executed read, found end-of-stream
marker, returning null



--
View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-JMS-losing-messages-what-am-I-missing-tp4709127.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message