activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <>
Subject [jira] Commented: (AMQNET-223) Message Producer ONLY can produce to default Destionation if set during creation (NMSDestination set correctly on message though)
Date Mon, 14 Dec 2009 20:46:53 GMT


Timothy Bish commented on AMQNET-223:

That behaviour isn't entirely unexpected.  The code should actually be throwing an exception
when the client attempt to send a message to a destination other than the default when a MessageProducer
has been created with a default.  The only time that the send method can be used to send to
particular destinations is when you create a MessageProducer without a default destination.
 This is documented in the JMS API for the MessageProducer interface.  

The resolution to this issue is to perform the proper checking in MessageProducer and throw
an exception when the Send method is called with a destination that is not the default when
created with a default destination.  

> Message Producer ONLY can  produce to default Destionation if set during creation (NMSDestination
set correctly on message though)
> ----------------------------------------------------------------------------------------------------------------------------------
>                 Key: AMQNET-223
>                 URL:
>             Project: ActiveMQ .Net
>          Issue Type: Bug
>          Components: ActiveMQ
>    Affects Versions: 1.2.0
>         Environment: Windows XP SP3, Windows 2003 Server, Windows 2008 Server, Active
MQ 5.3
>            Reporter: Michel Van Hoof
>            Assignee: Timothy Bish
>            Priority: Critical
>             Fix For: 1.2.0
> During a test for another issue, i think i have found some rather strange but yet important
> When setting a default destination at creation of a MessageProducer, this producer can
ONLY send to this default location. Message location.
> For example, you create a producer to produce on queue.test, when you later on in your
code, try to use the same producer to publsih to queue.test.DLQ, it DOES set the NMSDestination
correctly, but it produces to queue.test..
> Some example code:
> {code:title=test.exe|borderStyle=solid}
> using System;
> using System.Collections.Generic;
> using System.Linq;
> using System.Text;
> using Apache.NMS;
> using Apache.NMS.ActiveMQ;
> namespace TransactionTest
> {
>     class Program
>     {
>         static void Main(string[] args)
>         {
>             IConnectionFactory oFactory = new ConnectionFactory("failover:(tcp://");
>             IDestination oDestionation = new Apache.NMS.ActiveMQ.Commands.ActiveMQQueue("producer.test");
>             IDestination oDLQ = new Apache.NMS.ActiveMQ.Commands.ActiveMQQueue("producer.test.DLQ");
>             IConnection oConnection = oFactory.CreateConnection();
>             oConnection.Start();
>             ISession oProducerSession = oConnection.CreateSession();
>             ISession oSession = oConnection.CreateSession();
>             IMessageProducer oProducer = oProducerSession.CreateProducer(oDestionation);
>             //Should arrive in "producer.test" since no idestination has been given
>             oProducer.Send(oProducer.CreateTextMessage("TEST MESSAGGE"));
>             //should arrive in producer.test.dlq since alternate destination was given
to producer
>             ITextMessage oMessge = new Apache.NMS.ActiveMQ.Commands.ActiveMQTextMessage("TEST
>             oProducer.Send(oDLQ, oMessge);
>             Console.WriteLine("Sending testmessages DONE");
>             //now.. for the consuming Part...
>             IMessageConsumer oConsumer = oSession.CreateConsumer(oDestionation);
>             oConsumer.Listener += OnMessage;
>             Console.ReadKey();
>         }
>         private static void OnMessage(IMessage message)
>         {
>             //HERE you will see that both messages, although the NMSDestination on the
message is set correctly, arrive at the queue: producer.test sicne this is the only one our
consumer is listening too, even though they have been published to two seperate destinations.
>             Console.WriteLine("Message Received on queue: " + message.NMSDestination.ToString());
>         }
>     }
> }
> {code} 

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message