You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Elizabeth Griffith <e_...@yahoo.com> on 2010/12/07 21:04:29 UTC

JMS Dyname Ring Queues

I am upgrading my Java program from MRG 1.2 to MRG 1.3. I tried using the new 
addressing syntax to pick up the ability to create a dynamic queue as a ring 
queue. I made the queue non-durable with the auto-delete and exclusive flags. 
Before fail over, when I query the broker that I am going to fail over to, the 
dynamic ring queue appears on the queue list. However, when I fail over to it, 
the queue disappears. Most of the time JMS does not receive an exception that 
the queue does not exist so it does not know that it needs to recreate the 
queue. Therefore, it behaves as if it is connected, but it does not receive any 
messages. On rare occasions, an exception is received by JMS, which is passed on 
to my code. My code then recreates the queue. If I use the old syntax, the 
program fails over just fine. Is there something I might be missing in the 
addressing syntax that is preventing this from working correctly, or is there a 
race condition for JMS receiving an exception for the missing queue?

Thanks,

Liz


      

Re: Client trouble

Posted by Alan Conway <ac...@redhat.com>.
On 12/09/2010 01:49 PM, Adam Kaminiecki wrote:
> I have one more question how can I get message synchronius? I know how to
> subscribe for asynchronius.
>
> Is method
>
> session.Sync();
>
> set all operation synchronius?
>
>

session.sync() will block until all previous operations on the session are 
completed. It doesn't have any effect on subsequent operations. Typical pattern 
is to do a bit of work asynchronously, then call session.sync() at the point 
where you want to be sure all the work has completed.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Client trouble

Posted by Adam Kaminiecki <ad...@dgt.com.pl>.
I have one  more question how can I get message synchronius? I know how 
to subscribe for asynchronius.

Is method

session.Sync();

set all operation synchronius?



Regards,
Adam


W dniu 2010-12-09 13:21, Gordon Sim pisze:
> On 12/09/2010 11:33 AM, Adam Kaminiecki wrote:
>> Hi
>>
>> I'm using C# client 0.6 and have some problems.
>>
>>
>> I can send and recive message from and send to
>> non durable,fanaut exchange
>>
>> but whenm I'm trying to do it whit topic or direct exchange no message
>> income ;/
>>
>> what am I doing wrong?
>>
>> code:
>>
>>
>> declaring exchange
>>
>> session.ExchangeDeclare(exchName, exchType, string.Empty, null,
>> Option.NONE);
>>
>> and declare consumer
>>
>> myClient = new MessageListener(session);
>> myClient.NewMessagee += MyClient_NewMessagee;
>> myqueue = session.Name;
>> session.QueueDeclare(myqueue,string.Empty,null,op);
>> session.ExchangeBind(myqueue, exchName, routingKey);
>> session.AttachMessageListener(myClient, myqueue);
>> session.MessageSubscribe(myqueue);
>>
>>
>> and sendding message
>> session.MessageTransfer(exchange, MessageAcceptMode.EXPLICIT,
>> MessageAcquireMode.PRE_ACQUIRED,new Header(), obj[1] as
>> byte[],Option.NONE);
>
> Your published message needs to include a routing key (unless the 
> exchange is a fanout exchange). I'm not familiar enough with that 
> particular client to tell you how to do that exactly. Look for 
> MessageProperties in the Header perhaps?
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Client trouble

Posted by Gordon Sim <gs...@redhat.com>.
On 12/09/2010 12:35 PM, Adam Kaminiecki wrote:
> Nice, thanks for quick reply.
>
> You are right:) I missed it that becasue when I was using
>
> session.MessageTransfer(exchange,routingKey,mes);
>
> everything is ok. but If I want to set persistence.... How to set Header
> for propely sending message to direct and topic exhcange??

You can set the message to be persistent by setting the delivery-mode in 
delivery properties to be 'persistent' (value 2). You can (orthogonally) 
set the queue to be durable by setting the durable parameter to declare 
to true.

The message will be stored persistently if it is marked as persistent 
and is enqueued on a durable queue.

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Client trouble

Posted by Adam Kaminiecki <ad...@dgt.com.pl>.
Nice, thanks for quick reply.

You are right:) I missed it that becasue when I was using

  session.MessageTransfer(exchange,routingKey,mes);

everything is ok.  but If I want to set persistence.... How to set 
Header for propely sending message to direct and topic exhcange??


Regards,
Adam


W dniu 2010-12-09 13:21, Gordon Sim pisze:
> On 12/09/2010 11:33 AM, Adam Kaminiecki wrote:
>> Hi
>>
>> I'm using C# client 0.6 and have some problems.
>>
>>
>> I can send and recive message from and send to
>> non durable,fanaut exchange
>>
>> but whenm I'm trying to do it whit topic or direct exchange no message
>> income ;/
>>
>> what am I doing wrong?
>>
>> code:
>>
>>
>> declaring exchange
>>
>> session.ExchangeDeclare(exchName, exchType, string.Empty, null,
>> Option.NONE);
>>
>> and declare consumer
>>
>> myClient = new MessageListener(session);
>> myClient.NewMessagee += MyClient_NewMessagee;
>> myqueue = session.Name;
>> session.QueueDeclare(myqueue,string.Empty,null,op);
>> session.ExchangeBind(myqueue, exchName, routingKey);
>> session.AttachMessageListener(myClient, myqueue);
>> session.MessageSubscribe(myqueue);
>>
>>
>> and sendding message
>> session.MessageTransfer(exchange, MessageAcceptMode.EXPLICIT,
>> MessageAcquireMode.PRE_ACQUIRED,new Header(), obj[1] as
>> byte[],Option.NONE);
>
> Your published message needs to include a routing key (unless the 
> exchange is a fanout exchange). I'm not familiar enough with that 
> particular client to tell you how to do that exactly. Look for 
> MessageProperties in the Header perhaps?
>
> ---------------------------------------------------------------------
> Apache Qpid - AMQP Messaging Implementation
> Project:      http://qpid.apache.org
> Use/Interact: mailto:users-subscribe@qpid.apache.org
>
>

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Client trouble

Posted by Gordon Sim <gs...@redhat.com>.
On 12/09/2010 11:33 AM, Adam Kaminiecki wrote:
> Hi
>
> I'm using C# client 0.6 and have some problems.
>
>
> I can send and recive message from and send to
> non durable,fanaut exchange
>
> but whenm I'm trying to do it whit topic or direct exchange no message
> income ;/
>
> what am I doing wrong?
>
> code:
>
>
> declaring exchange
>
> session.ExchangeDeclare(exchName, exchType, string.Empty, null,
> Option.NONE);
>
> and declare consumer
>
> myClient = new MessageListener(session);
> myClient.NewMessagee += MyClient_NewMessagee;
> myqueue = session.Name;
> session.QueueDeclare(myqueue,string.Empty,null,op);
> session.ExchangeBind(myqueue, exchName, routingKey);
> session.AttachMessageListener(myClient, myqueue);
> session.MessageSubscribe(myqueue);
>
>
> and sendding message
> session.MessageTransfer(exchange, MessageAcceptMode.EXPLICIT,
> MessageAcquireMode.PRE_ACQUIRED,new Header(), obj[1] as
> byte[],Option.NONE);

Your published message needs to include a routing key (unless the 
exchange is a fanout exchange). I'm not familiar enough with that 
particular client to tell you how to do that exactly. Look for 
MessageProperties in the Header perhaps?

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Client trouble

Posted by Adam Kaminiecki <ad...@dgt.com.pl>.
Hi

I'm using C# client 0.6 and have some problems.


I can send and recive message from and send to
non durable,fanaut  exchange

but whenm I'm trying to do it whit topic or direct exchange no message 
income ;/

what am I doing wrong?

code:


declaring exchange

session.ExchangeDeclare(exchName, exchType, string.Empty, null, 
Option.NONE);

and declare consumer

myClient = new MessageListener(session);
myClient.NewMessagee += MyClient_NewMessagee;
myqueue = session.Name;
session.QueueDeclare(myqueue,string.Empty,null,op);
session.ExchangeBind(myqueue, exchName, routingKey);
session.AttachMessageListener(myClient, myqueue);
session.MessageSubscribe(myqueue);


and sendding message
session.MessageTransfer(exchange, MessageAcceptMode.EXPLICIT, 
MessageAcquireMode.PRE_ACQUIRED,new Header(), obj[1] as byte[],Option.NONE);

Please give me some advice to correct it..



Regards,
Adam


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Need help with documentation

Posted by Adam Kaminiecki <ad...@dgt.com.pl>.
>
>>
>> and all in enum Option
>>
>>
>
> what header file?
>
transport


Regards,
Adam

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: Need help with documentation

Posted by Carl Trieloff <cc...@redhat.com>.
On 12/08/2010 09:57 AM, Adam Kaminiecki wrote:
> Hi,
>
> Can anybody give me a link to api documentation??
> I'm interested in some variables but I dont know what they exacly do.
>
> MessageAcceptMode.EXPLICIT

This means the message is not dequeued from the queue until you 
explicitly accept the message

>
> MessageAcquireMode.PRE_ACQUIRED  and NOT_ACQUIRED


Think of this as locking. pre means lock the message before the action, 
not acquired (no lock).

Thus with not_ I can create a queue behaviour that everyone can see the 
same message. If I 'receive
a message and I want to use explicit accept + don't want anyone else to 
be able to see the message
while I decide to accept or reject it I would use PRE_ACQUIRED.

>
> and all in enum Option
>
>

what header file?

>
> Regards,
> Adam
>


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Need help with documentation

Posted by Adam Kaminiecki <ad...@dgt.com.pl>.
Hi,

Can anybody give me a link to api documentation??
I'm interested in some variables but I dont know what they exacly do.

MessageAcceptMode.EXPLICIT

MessageAcquireMode.PRE_ACQUIRED  and NOT_ACQUIRED

and all in enum Option



Regards,
Adam

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: JMS Dyname Ring Queues

Posted by Gordon Sim <gs...@redhat.com>.
On 12/08/2010 07:42 PM, Elizabeth Griffith wrote:
> The new syntax string is
> DynamicQueueName; { create: receiver,
>                                        node:
>                                        { type: queue,
>                                          durable: false,
>                                          x-declare:
>                                          { auto-delete: true,
>                                            exclusive: true,
>                                            arguments:
>                                            { 'qpid.max_count': 100,
>                                              'qpid.policy_type': ring }
>                                          },
>                                          x-bindings:
>                                          [ { exchange: ExchangeName,
>                                              queue: 'DynamicQueueName',
>                                              key: RoutingKey } ]
>                                        }
>                                     }

There does indeed appear to be a bug in the implementation of the new 
addressing in the JMS client. Temporary (i.e. auto-delete) queues are 
not recreated on failover, so the re-subscription attempt fails[1].

Unfortunately it appears not to support client side delete policies 
either[2].

The only workaround I can think of using the new addressing is to use a 
durable subscription. However that would make the queue durable which 
probably isn't desirable.

I'd stick with the old address sytnax in this case. You can do that on a 
case by case basis by prefixing the old address with 'BURL:' I believe.

[1] https://issues.apache.org/jira/browse/QPID-2975
[2] https://issues.apache.org/jira/browse/QPID-2976

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


Re: JMS Dyname Ring Queues

Posted by Elizabeth Griffith <e_...@yahoo.com>.
Jonathan,

The old syntax string is
direct://ExchangeName//DynamicQueueName?routingkey='RoutingKey'&autodelete='true'

The qpid-config output for it is
DynamicQueueName    auto-del

The new syntax string is
DynamicQueueName; { create: receiver,
                                      node:
                                      { type: queue,
                                        durable: false,
                                        x-declare:
                                        { auto-delete: true,
                                          exclusive: true,
                                          arguments:
                                          { 'qpid.max_count': 100,
                                            'qpid.policy_type': ring }
                                        },
                                        x-bindings:
                                        [ { exchange: ExchangeName,
                                            queue: 'DynamicQueueName',
                                            key: RoutingKey } ]
                                      }
                                   }
The qpid-config output for it is
DynamicQueueName    auto-del excl -- max-queue-count=100 -limit-policy=ring

Thanks,

Liz




________________________________
From: Jonathan Robie <jo...@redhat.com>
To: users@qpid.apache.org
Sent: Tue, December 7, 2010 5:18:22 PM
Subject: Re: JMS Dyname Ring Queues

Hi Liz,

Can you show me the address, using the old vs. new syntaxes? Also, can you show 
the output of $ qpid-config queues, after creating the new queues with each 
syntax?

Jonathan

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org


      

Re: JMS Dyname Ring Queues

Posted by Jonathan Robie <jo...@redhat.com>.
Hi Liz,

Can you show me the address, using the old vs. new syntaxes? Also, can 
you show the output of $ qpid-config queues, after creating the new 
queues with each syntax?

Jonathan

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:users-subscribe@qpid.apache.org