Channels

Motivations

Some applications may require to interact with agents directly, that is OO code interacting with your agents and not only agents interacting with other agents.

"Wait a minute, isn't Janus an Agent Platform? Why would I need OO code mixed with my agents?"

Hundreds of reasons come to mind. For instance:

  • User Interfaces: you will probably need to provide some user interface to interact with your application. You might want to use swing, SWT or even RCP's like eclipse, netbeans, spring plaforms.
  • Legacy Systems: If you must turn your current application into a Multi-Agent based application you will probably have legacy code that needs to interact your agents (probably a wrapper agent, but that code will interact with your wrapper agent any way, so)

But mainly we are providing the mechanism for the million of reasons we can't imagine right now.

Of course you could directly give your OO code a reference to the agent object, but then you would have your agent code tightly coupled with your OO code.

We believe that Channel interactions provide a simple and reusable solution to this problem.

Understanding the framework

Basically Channels are ways to talking to an agent in terms it will understand. As agents are autonomous entities, it will have to accept to be talked to through channels. For that it must implement the ChannelInteractable interface.

Channel interactable agents implement two methods:

  • getSupportedChannels(): returns the set of channels this agent is able to understand.
  • getChannel(): returns an instance of a supported channel. This method takes a set of parameters that depend on the channel.

The Channel is an empty Interface that represents only a common parent for all channels.

Finally the ChannelInteractable is a "listener" for newly created agents. ChannelInteractableListener can be registered with the kernel to receive notifications.

Securtiy Considerations

While agents can directly implement channels, it is recommended to use different classes for this in order to prevent casting into the actual agent object. The platform tries to reduce to the maximum possible side effects if a foreign modules gets a reference to agent object, however you should not rely on this.

Related Tutorials

2016-01-24SARL 0.3.1 and Janus 2.0.3.1 are available.
2015-11-30SARL 0.3.0 and Janus 2.0.3.0 are available.
This page was last modified on 22 August 2012, at 10:13. This page has been accessed 6,763 times.
Copyright 2010-2017 © Janus Core Developers - Privacy policy