You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@qpid.apache.org by Angus Salkeld <as...@redhat.com> on 2011/05/24 14:59:23 UTC

Some questions about writing a QMF2 Console application in C++

Hi

I am writing an application that needs to talk to a number of agents
(say 20+).

This Console needs to both receive events and make method calls to the
agent (I am doing it using the async API).

I had 2 ideas on how to do this:

1) create a ConsoleSession per agent and use setAgentFilter() or
   subscribe() to restrict the events to the ones I want.

   - What is the overhead of creating ConsoleSessions?
   - Should I use setAgentFilter() or subscribe()? - why would I use
     one over the other?
   - What is the format of the filter? the same as query() - s-expression
   - What can I filter on? class/properties/...

2) create only one ConsoleSession and somehow figure out where the
   events have come from.

   - Is there an efficient way of determining where an event has come
     from? (I don't have control of the contents of the event)
   - what is the scope of the corralation-id (returned from callMethodAsync)
     session or agent?


Would you recommend one way over the other - any other suggestions?

Thanks
Angus Salkeld


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


Re: Some questions about writing a QMF2 Console application in C++

Posted by Angus Salkeld <as...@redhat.com>.
On Tue, May 24, 2011 at 10:21:37AM -0400, Ted Ross wrote:
> On 05/24/2011 08:59 AM, Angus Salkeld wrote:
> >Hi
> >
> >I am writing an application that needs to talk to a number of agents
> >(say 20+).
> >
> >This Console needs to both receive events and make method calls to the
> >agent (I am doing it using the async API).
> >
> >I had 2 ideas on how to do this:
> >
> >1) create a ConsoleSession per agent and use setAgentFilter() or
> >    subscribe() to restrict the events to the ones I want.
> >
> >    - What is the overhead of creating ConsoleSessions?
> >    - Should I use setAgentFilter() or subscribe()? - why would I use
> >      one over the other?
> >    - What is the format of the filter? the same as query() - s-expression
> >    - What can I filter on? class/properties/...
> >
> >2) create only one ConsoleSession and somehow figure out where the
> >    events have come from.
> >
> >    - Is there an efficient way of determining where an event has come
> >      from? (I don't have control of the contents of the event)
> >    - what is the scope of the corralation-id (returned from callMethodAsync)
> >      session or agent?
> >
> >
> >Would you recommend one way over the other - any other suggestions?
> 
> I would recommend option 2 (single ConsoleSession).  The
> ConsoleEvent class has a getAgent method that returns a reference to
> the agent that raised the event.
> 
> Use ConsoleSession::setAgentFilter to narrow the scope of visible
> agents to the set that you are interested in.  Use
> ConsoleEvent::getAgent to identify the agent that is associated with
> an async event.
> 
> The agent filter is an s-expression string.  The identifying fields
> for an agent are "_vendor", "_product", and "_instance".  You can
> also query on any arbitrary agent-defined attribute that is set by
> the agent in the setAttribute method.  To filter all agents but
> those of a particular vendor/product pair, use "[and, [eq, _vendor,
> [quote, 'vendor-name.com']], [eq, _product, [quote,
> 'product-name']]]".
> 
> The scope of the correlation-id is per-Agent which means that you
> will need the combination of (agent X id) to properly correlate the
> event.  This seems sub-optimal to me and I will raise a Jira
> requesting that the scope be made per-ConsoleSession.

Thanks for the help Ted, that all makes sense.

-Angus

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

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


Re: Some questions about writing a QMF2 Console application in C++

Posted by Ted Ross <tr...@redhat.com>.
On 05/24/2011 08:59 AM, Angus Salkeld wrote:
> Hi
>
> I am writing an application that needs to talk to a number of agents
> (say 20+).
>
> This Console needs to both receive events and make method calls to the
> agent (I am doing it using the async API).
>
> I had 2 ideas on how to do this:
>
> 1) create a ConsoleSession per agent and use setAgentFilter() or
>     subscribe() to restrict the events to the ones I want.
>
>     - What is the overhead of creating ConsoleSessions?
>     - Should I use setAgentFilter() or subscribe()? - why would I use
>       one over the other?
>     - What is the format of the filter? the same as query() - s-expression
>     - What can I filter on? class/properties/...
>
> 2) create only one ConsoleSession and somehow figure out where the
>     events have come from.
>
>     - Is there an efficient way of determining where an event has come
>       from? (I don't have control of the contents of the event)
>     - what is the scope of the corralation-id (returned from callMethodAsync)
>       session or agent?
>
>
> Would you recommend one way over the other - any other suggestions?

I would recommend option 2 (single ConsoleSession).  The ConsoleEvent 
class has a getAgent method that returns a reference to the agent that 
raised the event.

Use ConsoleSession::setAgentFilter to narrow the scope of visible agents 
to the set that you are interested in.  Use ConsoleEvent::getAgent to 
identify the agent that is associated with an async event.

The agent filter is an s-expression string.  The identifying fields for 
an agent are "_vendor", "_product", and "_instance".  You can also query 
on any arbitrary agent-defined attribute that is set by the agent in the 
setAttribute method.  To filter all agents but those of a particular 
vendor/product pair, use "[and, [eq, _vendor, [quote, 
'vendor-name.com']], [eq, _product, [quote, 'product-name']]]".

The scope of the correlation-id is per-Agent which means that you will 
need the combination of (agent X id) to properly correlate the event.  
This seems sub-optimal to me and I will raise a Jira requesting that the 
scope be made per-ConsoleSession.

-Ted

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


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