ie.nuigalway.ecrg.jade.jmsmtp.providersupport
Class QueueListener

java.lang.Object
  |
  +--ie.nuigalway.ecrg.jade.jmsmtp.providersupport.QueueListener
All Implemented Interfaces:
javax.jms.ExceptionListener, javax.jms.MessageListener

public class QueueListener
extends java.lang.Object
implements javax.jms.MessageListener, javax.jms.ExceptionListener


Field Summary
private  javax.jms.QueueConnection conn
           
private  jade.mtp.InChannel.Dispatcher dispatcher
           
private  JMSAddress jmsTA
           
private static org.apache.log4j.Category log
           
private  MapMessageUtil mapUtil
           
private  ProviderAdmin pAdmin
           
private  javax.jms.Queue que
           
private  javax.jms.QueueSession session
           
private  FipaXMLUtil xmlUtil
           
 
Constructor Summary
QueueListener(javax.jms.QueueConnection conn, jade.mtp.InChannel.Dispatcher dispatcher, JMSAddress jmsTA)
          Creates a new QueueListener object.
 
Method Summary
 ProviderAdmin getProviderAdmin(java.lang.String providerType)
          Get the Admin interface for a specific JMS provider
 void onException(javax.jms.JMSException jmse)
          Method is executed when an execption is thrown by the JMS Provider Attempts to reconnect to the provider
 void onMessage(javax.jms.Message msg)
          Method is executed when a message is receivd from the agents queue
private  void setupConnection()
          Method is executed in order to create a connection to a JMS server and listen to
 void stop()
          Method is executed to disconnect from a JMS server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.log4j.Category log

dispatcher

private jade.mtp.InChannel.Dispatcher dispatcher

jmsTA

private JMSAddress jmsTA

xmlUtil

private FipaXMLUtil xmlUtil

mapUtil

private MapMessageUtil mapUtil

conn

private javax.jms.QueueConnection conn

session

private javax.jms.QueueSession session

que

private javax.jms.Queue que

pAdmin

private ProviderAdmin pAdmin
Constructor Detail

QueueListener

public QueueListener(javax.jms.QueueConnection conn,
                     jade.mtp.InChannel.Dispatcher dispatcher,
                     JMSAddress jmsTA)
              throws java.lang.Exception
Creates a new QueueListener object.

Parameters:
conn - Connection to use
dispatcher - Dispatcher to send the messages to
jmsTA - Address to listen to
Throws:
java.lang.Exception - Description of the Exception
Method Detail

setupConnection

private void setupConnection()
                      throws javax.jms.JMSException,
                             jade.mtp.MTPException
Method is executed in order to create a connection to a JMS server and listen to

Throws:
javax.jms.JMSException
jade.mtp.MTPException

onMessage

public void onMessage(javax.jms.Message msg)
Method is executed when a message is receivd from the agents queue

Specified by:
onMessage in interface javax.jms.MessageListener
Parameters:
msg - JMS Message received

onException

public void onException(javax.jms.JMSException jmse)
Method is executed when an execption is thrown by the JMS Provider Attempts to reconnect to the provider

Specified by:
onException in interface javax.jms.ExceptionListener
Parameters:
jmse - JMS Exception thrown

stop

public void stop()
          throws java.lang.Exception
Method is executed to disconnect from a JMS server

Throws:
java.lang.Exception - Error in closeing JMS Connection

getProviderAdmin

public ProviderAdmin getProviderAdmin(java.lang.String providerType)
                               throws java.lang.Exception
Get the Admin interface for a specific JMS provider

Parameters:
providerType - Providers interface to return
Returns:
JMS providers admin interface
Throws:
java.lang.Exception - Error in creating the provider interface