You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Adam Kaminiecki <ad...@dgt.com.pl> on 2010/12/09 12:33:18 UTC

Client trouble

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