Details
Description
I have a Java process and a C++ process communicating using ActiveMQ. For some messages the C++ process will produce big results which are sent in chunks in separate ByteMessages (very similar to ActiveMQInput/OutputStream). To receive these chunks the Java process generates a temporary queue and sends the name of the queue (result of getQueueName) to the C++ process. The C++ process then sends the ByteMessages to this temporary queue using this code:
std::string targetQueue = // get queue name sent by Java
session = connection->createSession(cms::Session::AUTO_ACKNOWLEDGE);
queue = session->createQueue(targetQueue);
producer = session->createProducer(queue);
producer->setDeliveryMode(cms::DeliveryMode::PERSISTENT);
while(fillBuffer())
{ std::auto_ptr<cms::BytesMessage> blockMessage(session->createBytesMessage()); blockMessage->writeBytes(reinterpret_cast<unsigned char *>(buffer), 0, bc); producer->send(blockMessage.get()); }On the Java side I never receive the messages sent by C++ but I don't get any error from the C++ code either. When I change the Java code to create a regular queue instead of a temporary queue the code works fine.
I had a look at the Java implementation of ActiveMQSession::createQueue and found that they have a special case handling for temporary queues that is missing from the C++ code. After adding this special case to the C++ implementation the code above works fine.