com.googlecode.fascinator.common
Class MessagingServices

java.lang.Object
  extended by com.googlecode.fascinator.common.MessagingServices

public class MessagingServices
extends Object

Messaging services

Author:
Oliver Lucido

Field Summary
static String ERROR_TOPIC
          Error topic string
static String MESSAGE_TOPIC
          Message topic string
static String SUBSCRIBER_QUEUE
          Subscriber Queue name
 
Method Summary
 javax.jms.Connection getConnection()
          Gets the JMS connection
static MessagingServices getInstance()
          Get messaging service instance
 javax.jms.MessageProducer getProducer()
          Gets the JMS message producer with no default destination
 javax.jms.Session getSession()
          Gets the JMS session
 void onEvent(Map<String,String> param)
          To put events to subscriber queue
 void publishMessage(String name, String msg)
          Sends a message to a JMS topic.
 void queueMessage(String name, String msg)
          Sends a message to a JMS queue.
 void release()
          Closes the JMS connections.
 void sendMessage(javax.jms.Destination destination, String msg)
          Sends a message to a JMS destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBSCRIBER_QUEUE

public static final String SUBSCRIBER_QUEUE
Subscriber Queue name

See Also:
Constant Field Values

ERROR_TOPIC

public static final String ERROR_TOPIC
Error topic string

See Also:
Constant Field Values

MESSAGE_TOPIC

public static final String MESSAGE_TOPIC
Message topic string

See Also:
Constant Field Values
Method Detail

getInstance

public static MessagingServices getInstance()
                                     throws javax.jms.JMSException
Get messaging service instance

Returns:
Messaging service instance
Throws:
javax.jms.JMSException - if an error occurred starting the JMS connections

getConnection

public javax.jms.Connection getConnection()
Gets the JMS connection

Returns:
JMS connection

getSession

public javax.jms.Session getSession()
Gets the JMS session

Returns:
JMS session

getProducer

public javax.jms.MessageProducer getProducer()
Gets the JMS message producer with no default destination

Returns:
JMS message producer

release

public void release()
Closes the JMS connections. This will only close the connections if there are no longer any references to the instance.


publishMessage

public void publishMessage(String name,
                           String msg)
Sends a message to a JMS topic.

Parameters:
name - topic name
msg - message to send

queueMessage

public void queueMessage(String name,
                         String msg)
Sends a message to a JMS queue.

Parameters:
name - queue name
msg - message to send

sendMessage

public void sendMessage(javax.jms.Destination destination,
                        String msg)
                 throws javax.jms.JMSException
Sends a message to a JMS destination.

Parameters:
name - destination name
msg - message to send
Throws:
javax.jms.JMSException

onEvent

public void onEvent(Map<String,String> param)
To put events to subscriber queue

Parameters:
oid - Object id
eventType - type of events happened
context - where the event happened
jsonFile - Configuration file


Copyright © 2009-2011. All Rights Reserved.