com.googlecode.fascinator.common.messaging
Class MessagingServices

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

public class MessagingServices
extends java.lang.Object

Messaging services

Author:
Oliver Lucido

Field Summary
static java.lang.String ERROR_TOPIC
          Error topic string
static java.lang.String MESSAGE_TOPIC
          Message topic string
static java.lang.String SUBSCRIBER_QUEUE
          Subscriber Queue name
 
Method Summary
static MessagingServices getInstance()
          Get messaging service instance
 javax.jms.Connection newConnection()
          Establish a new JMS Connection to the local broker
 javax.jms.Session newSession()
          Establish a new JMS Session on an existing connection to the local broker
 void onEvent(java.util.Map<java.lang.String,java.lang.String> param)
          To put events to subscriber queue
 void publishMessage(java.lang.String name, java.lang.String msg)
          Sends a textual message to the named topic of the local broker.
 void publishMessage(java.lang.String brokerUrl, java.lang.String name, java.lang.String msg)
          Sends a textual message to the named topic on any broker.
 void queueMessage(java.lang.String name, java.lang.String msg)
          Sends a textual message to a named JMS queue on the local broker
 void queueMessage(java.lang.String brokerUrl, java.lang.String name, java.lang.String msg)
          Sends a textual message to a named JMS queue on any broker.
 void release()
          Closes the JMS connections.
 void sendMessage(java.lang.String brokerUrl, javax.jms.Destination destination, javax.jms.TextMessage msg)
          Sends a JMS message to an instantiated 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 java.lang.String SUBSCRIBER_QUEUE
Subscriber Queue name

See Also:
Constant Field Values

ERROR_TOPIC

public static final java.lang.String ERROR_TOPIC
Error topic string

See Also:
Constant Field Values

MESSAGE_TOPIC

public static final java.lang.String MESSAGE_TOPIC
Message topic string

See Also:
Constant Field Values
Method Detail

getInstance

public static MessagingServices getInstance()
                                     throws MessagingException
Get messaging service instance

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

newConnection

public javax.jms.Connection newConnection()
                                   throws MessagingException
Establish a new JMS Connection to the local broker

Returns:
Connection JMS connection
Throws:
MessagingException - if an error occurs

newSession

public javax.jms.Session newSession()
                             throws MessagingException
Establish a new JMS Session on an existing connection to the local broker

Returns:
Session JMS session
Throws:
MessagingException - if an error occurs

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(java.lang.String name,
                           java.lang.String msg)
                    throws MessagingException
Sends a textual message to the named topic of the local broker.

Parameters:
name - The topic to send to
msg - The message to send
Throws:
MessagingException - If any errors occur in resolving the destination or sending.

publishMessage

public void publishMessage(java.lang.String brokerUrl,
                           java.lang.String name,
                           java.lang.String msg)
                    throws MessagingException
Sends a textual message to the named topic on any broker.

Parameters:
brokerUrl - The broker to send to
name - The topic to send to
msg - The message to send
Throws:
MessagingException - If any errors occur in resolving the destination or sending.

queueMessage

public void queueMessage(java.lang.String name,
                         java.lang.String msg)
                  throws MessagingException
Sends a textual message to a named JMS queue on the local broker

Parameters:
name - The queue to send to
msg - The message to send
Throws:
MessagingException - If any errors occur in resolving the destination or sending.

queueMessage

public void queueMessage(java.lang.String brokerUrl,
                         java.lang.String name,
                         java.lang.String msg)
                  throws MessagingException
Sends a textual message to a named JMS queue on any broker.

Parameters:
brokerUrl - The broker to send to
name - The queue to send to
msg - The message to send
Throws:
MessagingException - If any errors occur in resolving the destination or sending.

sendMessage

public void sendMessage(java.lang.String brokerUrl,
                        javax.jms.Destination destination,
                        javax.jms.TextMessage msg)
                 throws MessagingException
Sends a JMS message to an instantiated JMS destination.

Parameters:
brokerUrl - The broker with an existing producer to use in sending
destination - The destination to send to
msg - The message to send
Throws:
MessagingException - If an error occurs when attempting to send

onEvent

public void onEvent(java.util.Map<java.lang.String,java.lang.String> param)
             throws MessagingException
To put events to subscriber queue

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


Copyright © 2009-2013. All Rights Reserved.