Changes to the messaging API

The ongoing development of Aglets has changed the messaging API. Changes are due to a refactoring process which aim is to provide a better modularity and more power.

The first change regards the introduction of the package, that contains all the message related stuff (i.e., message classes, arguments and exceptions). New applications should use the classes contained in this package for the messaging. This means that instead of using, developers should now refer to Similar considerations for the other classes, in particular:

Nevertheless, in order to not break backward compatibility, there are still the same classes in the package. The latter classes inherit from the ones and are now deprecated. In other words, inherits from This allows you to still compile and run your old applications, but please note that new applications should use the new classes.

Another change introduces the message priority. Now the Message class has a set/get priority methods, declared final, that can be used to manage the priority of the message. Thanks to this, an agent can post a message to another agent specifying a priority at which the addressee agent should process such message. The message queue objects have been adapted to use such priority in order to push and pop messages depending on their priority.
An agent can specify the message priority chosing among a few constants defined in the Message class itself, in particular among MIN_PRIORITY, MAX_PRIORITY and NORMAL_PRIORITY. The priority is specified as an integer (int), and in the current implementation the priority is normalized at NORMAL_PRIORITY if it does not fit the priority range.

For details about the implementation please see the mailing list thread:

Posted by Luca Ferrari 2007-11-13

Log in to post a comment.