You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Michel Van Hoof (JIRA)" <ji...@apache.org> on 2009/12/14 12:11:53 UTC

[jira] Created: (AMQNET-223) Message Producer produces to default Destionation if set during creation

Message Producer produces to default Destionation if set during creation
------------------------------------------------------------------------

                 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: Jim Gomes
            Priority: Critical


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.


[jira] Assigned: (AMQNET-223) Message Producer ONLY can produce to default Destionation if set during creation (NMSDestination set correctly on message though)

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish reassigned AMQNET-223:
-----------------------------------

    Assignee: Timothy Bish  (was: Jim Gomes)

> 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
>
> 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.


[jira] Updated: (AMQNET-223) Message Producer ONLY can produce to default Destionation if set during creation (NMSDestination set correctly on message though)

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Bish updated AMQNET-223:
--------------------------------

    Fix Version/s: 1.2.0

> 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.


[jira] Resolved: (AMQNET-223) Message Producer ONLY can produce to default Destionation if set during creation (NMSDestination set correctly on message though)

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
     [ 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.


[jira] Commented: (AMQNET-223) Message Producer ONLY can produce to default Destionation if set during creation (NMSDestination set correctly on message though)

Posted by "Timothy Bish (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQNET-223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56441#action_56441 ] 

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: 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.


[jira] Updated: (AMQNET-223) Message Producer ONLY can produce to default Destionation if set during creation (NMSDestination set correctly on message though)

Posted by "Michel Van Hoof (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQNET-223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michel Van Hoof updated AMQNET-223:
-----------------------------------

    Summary: Message Producer ONLY can  produce to default Destionation if set during creation (NMSDestination set correctly on message though)  (was: Message Producer produces to default Destionation if set during creation)

fixed description of issue because was not ver clear

> 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: Jim Gomes
>            Priority: Critical
>
> 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.