Uploaded image for project: 'ActiveMQ C++ Client'
  1. ActiveMQ C++ Client
  2. AMQCPP-502

Can't send to temporary queues created by name

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.4.0
    • 3.8.0
    • CMS Impl
    • None
    • Windows Vista, Visual Studio 2005

    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.

      Attachments

        1. activemq.patch
          4 kB
          Thomas Krammer

        Activity

          People

            tabish Timothy A. Bish
            tkrammer Thomas Krammer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: