if is possible to publish more than one Agent on a single adress:port?

26 views
Skip to first unread message

Ricardo Aguirre

unread,
Feb 20, 2012, 5:51:06 AM2/20/12
to ya...@googlegroups.com
Hi,
Do you know if is possible to publish more than one Agent on a single adress:port ?
Actually when I try to do it, I get:
raised YAMI.LOGIC_ERROR : The object is in a wrong state.

Thank you for your help

--Panzón

Maciej Sobczak

unread,
Feb 20, 2012, 7:06:13 AM2/20/12
to yami4
On 20 Lut, 11:51, Ricardo Aguirre <el.mas...@gmail.com> wrote:

> Do you know if is possible to publish more than one Agent on a single
> adress:port ?

What do you mean by this?
The agent is a an object that encapsulates network and system
resources that are needed for communication. You cannot "publish" it -
you can, however, publish some data with the help of the agent and it
should be possible to do it with any number of data sources.

Can you show some minimal code example that is causing troubles? Did
you try to scale up the example publish-subscribe programs?

--
Maciej Sobczak * http://www.inspirel.com

Ricardo Aguirre

unread,
Feb 20, 2012, 12:00:42 PM2/20/12
to ya...@googlegroups.com
Thank you for explain me what does an Agent is, I had not understood before.
What I try to do is:
make two publishers (I base on your publish subscribe example) that are publishing different data on the same ip:port. Then I will have different  consumers, on different places, which will consume these data obviusly searching for "Match_Event" and "Luxe_Fotogram_Frame" in its own agent (client side).

Maybe I should use one Agent for each publisher and I need also one ip:port for each.
I'm just trying to use at least resources as possible.
 
--Panzón


2012/2/20 Maciej Sobczak <see.my....@gmail.com>

Maciej Sobczak

unread,
Feb 21, 2012, 4:15:09 AM2/21/12
to yami4
On 20 Lut, 18:00, Ricardo Aguirre <el.mas...@gmail.com> wrote:

> What I try to do is:
> make two publishers <http://pastebin.com/8j10kKSH> (I base on your publish
> subscribe example) that are publishing different data on the same ip:port.
> Then I will have different  consumers, on different places, which will
> consume these data obviusly searching for "Match_Event" and
> "Luxe_Fotogram_Frame" in its own agent (client side).

This is perfectly possible, but you did not show the complete program,
just a body for a single package. How are all these procedures called?
Note that you do not need to Add_Listener twice - on the contrary, you
should *not* do it. Adding a listener twice for the same ip:port is
pointless and will cause errors.
Try to split the logic of your program in the following way:

1. make agent and add a single listener to it
2. register two value publishers
3. loop: publish data when it is ready

It is OK to make agent at the package level, but normally you will
rather want to do it inside some outer subprogram (in simple
subprograms this can be the main procedure), as the configuration
options for the agent are frequently obtained at run-time (during the
program initialization phase), not at elaboration time.

> Maybe I should use one Agent for each publisher and I need also one ip:port
> for each.

No, this will not work either. The reason is that a single ip:port
combination can be used only once (for listening) in the whole system.
You cannot use it twice in the same agent or in two separate agents in
the same program or even in two separate programs.

Regards,

Ricardo Aguirre

unread,
Feb 21, 2012, 6:32:29 AM2/21/12
to ya...@googlegroups.com
Thank you, the problem was "that I was "adding a Listener two times"; I just delete the second listener (delete lines 43-47 ) and thats all.
Now is working

Thanks


--Panzón



2012/2/21 Maciej Sobczak <see.my....@gmail.com>
Reply all
Reply to author
Forward
0 new messages