Amin Sh Amin Sh - 7 months ago 132
Java Question

Apache Camel: Reply received for unknown correlationID

There is a

middleware
in between of two other software components. In the
middleware
I'm routing
Apache ActiveMQ
messages by
Apache Camel
.

this is how it works:


  1. 1stComponent
    uses
    middleware
    to send message to the
    3rdComponent

  2. 3rdComponent
    replies the message and sends it back to the
    1st
    (using
    middleware
    ).

    1stComponent <<=>> Middleware <<=>> 3rdComponent



Problem:

I'm using
ConcurrentConsumers
in middleware.

In the middle of sending a lot of messages sequentially, suddenly
middleware
stops all the process!
there is no exceptions or messages!
for example, first 100 of 500 messages got processed and the remainders remain in the queue as pending messages.

this warning is logged sometimes in the middle of the process:

[WARN ] TemporaryQueueReplyManager(Camel (camel-1) thread #11 - TemporaryQueueReplyManager[Q.MyQ]):91 - Reply received for unknown correlationID [c551c7aa061f501c]. The message will be ignored: ActiveMQMapMessage {commandId = 2161, responseRequired = true, messageId = ID:xxxxxxx, originalDestination = null, originalTransactionId = null, producerId = ID:xxxxxxx, destination = temp-queue://ID:localhost.localdomain-40961-1389890357282-3:1:1, transactionId = null, expiration = 0, timestamp = 1389890272360, arrival = 0, brokerInTime = 1389890272360, brokerOutTime = 1389890272360, correlationId = c551c7aa061f501c, replyTo = temp-queue://ID:localhost.localdomain-40961-1389890357282-3:1:1, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = null, marshalledProperties = org.apache.activemq.util.ByteSequence@19e19da, dataStructure = null, redeliveryCounter = 0, size = 0, properties = {breadcrumbId=ID:xxxxxxxxxxxxxx, Title=300, CamelJmsDeliveryMode=1}, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false} ActiveMQMapMessage{ theTable = {} }


this is the
middlewares
Code:

private static class MyRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
from("activemq:queue:Q.Middleware?concurrentConsumers=1&maxConcurrentConsumers=10")
.threads(1, 100)
.process(new Processor() {
public void process(Exchange exchange) {
//some code
}
})
.inOut("activemq2:queue:Q.3RD")
;
}
}


and the
3rdComponent
:

private static class MyRouteBuilder extends RouteBuilder {
@Override
public void configure() {
from("activemq:queue:Q.3RD")
.threads(1, 100)
.process(new Processor() {
public void process(Exchange exchange) {
//some code
}
})
;
}
}

Answer

UPDATE:

My previous answer is working correctly, but was not the complete solution.

The mistake was producing non-unique CorrelationIDs! (a bug in random string generators) simple!!! :|

Comments