activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <jira+amq...@apache.org>
Subject [jira] Resolved: (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 22:07:52 GMT

     [ https://issues.apache.org/activemq/browse/AMQNET-223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Timothy Bish resolved AMQNET-223.
---------------------------------

    Resolution: Fixed

Resolved in trunk and 1.2.x branch.  Fix by having the MessageProducer throw the correct exceptions
when used incorrectly.  

The following checks were added.
* Cannot send to a destination other than the one the producer was created with.
* If not created with a destination then sends must always supply a destination and will throw
if destination is null.

> Message Producer ONLY can  produce to default Destionation if set during creation (NMSDestination
set correctly on message though)
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQNET-223
>                 URL: https://issues.apache.org/activemq/browse/AMQNET-223
>             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
behaviour.
> 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://10.32.1.24:1414)");
>             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
MESSAGE DLQ");
>             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.


Mime
View raw message