activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Tully <gary.tu...@gmail.com>
Subject Re: MapMessage - theTable empty when receiving
Date Wed, 03 Nov 2010 09:33:54 GMT
note that on the sent message the content=null, on the received
message the content is a valid byte sequence.
The map will be unmarshalled from the byte array as part of the first
get opeation on the map message.

On 2 November 2010 10:57, brownm_uk <brownm_uk@yahoo.co.uk> wrote:
>
> I've just installed version 5.4.1 on Windows and altered the ProducerTool
> example source code to produce MapMessages instead of TextMessages (patch
> for ProducerTool.java at end of this email).  When I run the producer &
> consumer pair from Ant as per the usual instructions, I see the 'produced'
> messages contain the right data in 'theTable' ...
>
>     [java] [Thread-2] Sending message: 'ActiveMQMapMessage {commandId = 0,
> responseRequired = false, messageId = null, originalDestination = null,
> originalTransactionId = null, producerId = null, destination = null,
> transactionId = null, expiration = 0, timestamp = 0, arrival = 0,
> brokerInTime = 0, brokerOutTime = 0, correlationId = null, replyTo = null,
> persistent = false, type = null, priority = 0, 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} ActiveMQMapMessage{ theTable = {id=0} }'
>
> but in the 'consumed' messages 'theTable' appears empty ...
>
>     [java] [Thread-2] Received: 'ActiveMQMapMessage {commandId = 5,
> responseRequired = false, messageId =
> ID:pcdelldevmb-64173-1288693987697-0:0:1:1:1, originalDestination = null,
> originalTransactionId = null, producerId =
> ID:pcdelldevmb-64173-1288693987697-0:0:1:1, destination = queue://TEST.FOO,
> transactionId = null, expiration = 0, timestamp = 1288693988050, arrival =
> 0, brokerInTime = 1288693988050, brokerOutTime = 1288693988051,
> correlationId = null, replyTo = null, persistent = false, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content =
> org.apache.activemq.util.ByteSequence@1d225a7, marshalledProperties = null,
> dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
> readOnlyProperties = true, readOnlyBody = true, droppable = false}
> ActiveMQMapMessage{ theTable = {} }'
>
>
> Any ideas as to why this is happening and how I can receive the correct Map
> data in a MapMessage?
>
> Thanks in advance,
> Martin Brown
>
>
>
>
> --- ProducerTool.java.orig      2010-11-01 15:41:11.746392100 +0000
> +++ ProducerTool.java   2010-11-02 08:58:59.572244500 +0000
> @@ -22,6 +22,7 @@
>  import javax.jms.Connection;
>  import javax.jms.DeliveryMode;
>  import javax.jms.Destination;
> +import javax.jms.MapMessage;
>  import javax.jms.MessageProducer;
>  import javax.jms.Session;
>  import javax.jms.TextMessage;
> @@ -154,14 +155,17 @@
>
>         for (int i = 0; i < messageCount || messageCount == 0; i++) {
>
> -            TextMessage message =
> session.createTextMessage(createMessageText(i));
> +            // TextMessage message =
> session.createTextMessage(createMessageText(i));
> +            MapMessage message = session.createMapMessage();
> +           message.setInt("id", i);
>
>             if (verbose) {
> -                String msg = message.getText();
> -                if (msg.length() > 50) {
> -                    msg = msg.substring(0, 50) + "...";
> -                }
> -                System.out.println("[" + this.getName() + "] Sending
> message: '" + msg + "'");
> +                // String msg = message.getText();
> +                // if (msg.length() > 50) {
> +                //     msg = msg.substring(0, 50) + "...";
> +                // }
> +                // System.out.println("[" + this.getName() + "] Sending
> message: '" + msg + "'");
> +                System.out.println("[" + this.getName() + "] Sending
> message: '" + message + "'");
>             }
>
>             producer.send(message);
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/MapMessage-theTable-empty-when-receiving-tp3023521p3023521.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>



-- 
http://blog.garytully.com
http://fusesource.com

Mime
View raw message