You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Timothy Bish (JIRA)" <ji...@apache.org> on 2016/03/09 21:21:40 UTC

[jira] [Closed] (AMQ-6205) When two object messages are submitted to the queue, only the second message is ever read by the receiver

     [ https://issues.apache.org/jira/browse/AMQ-6205?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish closed AMQ-6205.
-----------------------------
    Resolution: Invalid

Please post questions on the users mailing list, Jira is where bug reports are submitted.  

> When two object messages are submitted to the queue, only the second message is ever read by the receiver
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-6205
>                 URL: https://issues.apache.org/jira/browse/AMQ-6205
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Transport
>    Affects Versions: 5.13.2
>         Environment: AMQ version is 5.13.2.
> Java 1.8.0_74
> transportConnector uri="vm://localhost"
> OS is Windows 10
>            Reporter: David Johnson
>
> This is cross-posted at http://stackoverflow.com/questions/35896002/activemq-jms-losing-messages-what-am-i-missing
> What am I missing?  I am hoping this is a PICNIC error (Problem In Chair, Not In Computer), but if so I am not seeing how.
> 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. This can be confirmed by looking at the message ID in the log.
> 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



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)