public class JMSUtils extends BaseUtils
Constructor and Description |
---|
JMSUtils() |
Modifier and Type | Method and Description |
---|---|
static Connection |
createConnection(ConnectionFactory conFac,
String user,
String pass,
boolean jmsSpec11,
Boolean isQueue)
This is a JMS spec independent method to create a Connection.
|
static MessageConsumer |
createConsumer(Session session,
Destination destination,
Boolean isQueue,
String subscriberName,
String messageSelector,
boolean pubSubNoLocal,
boolean isDurable,
boolean jmsSpec11)
This is a JMS spec independent method to create a MessageConsumer.
|
static MessageConsumer |
createConsumer(Session session,
Destination dest,
String messageSelector)
Create a MessageConsumer for the given Destination
|
static MessageProducer |
createProducer(Session session,
Destination destination,
Boolean isQueue,
boolean jmsSpec11)
This is a JMS spec independent method to create a MessageProducer.
|
static Session |
createSession(Connection connection,
boolean transacted,
int ackMode,
boolean jmsSpec11,
Boolean isQueue)
This is a JMS spec independent method to create a Session.
|
static Destination |
createTemporaryDestination(Session session)
Create a temp queue or topic for synchronous receipt of responses, when a reply destination
is not specified
|
static long |
getBodyLength(BytesMessage bMsg)
Return the body length in bytes for a bytes message
|
static String |
getDestination(String url)
Return the destination name from the given URL
|
static String |
getDestinationTypeAsString(int destType)
Return a String representation of the destination type
|
static long |
getMessageSize(Message message)
Get the length of the message in bytes
|
static String |
getProperty(Message message,
String property)
Get a String property from the JMS message
|
static Map<String,Object> |
getTransportHeaders(Message message)
Extract transport level headers for JMS from the given message into a Map
|
static boolean |
isJMSService(AxisService service)
Should this service be enabled over the JMS transport?
|
static void |
loadTransportHeaders(Message message,
MessageContext responseMsgCtx)
Read the transport headers from the JMS Message and set them to the axis2 message context
|
static <T> T |
lookup(Context context,
Class<T> clazz,
String name) |
static Destination |
lookupDestination(Context context,
String destinationName,
String destinationType)
Return the JMS destination with the given destination name looked up from the context
|
static Destination |
setReplyDestination(Destination replyDestination,
Session session,
Message message)
Set the JMS ReplyTo for the message
|
static void |
setSOAPEnvelope(Message message,
MessageContext msgContext,
String contentType)
Set the SOAPEnvelope to the Axis2 MessageContext, from the JMS Message passed in
|
static void |
setTransportHeaders(MessageContext msgContext,
Message message)
Set transport headers from the axis message context, into the JMS message
|
getEnvelope, getEPRProperties, getMessageFormatter, getOMOutputFormat, getQNameFromString, handleException, handleException, isBlank, isUsingTransport, loadProperties, markServiceAsFaulty
public static boolean isJMSService(AxisService service)
service
- the Axis servicepublic static String getProperty(Message message, String property)
message
- JMS messageproperty
- property namepublic static String getDestination(String url)
url
- the URLpublic static void setSOAPEnvelope(Message message, MessageContext msgContext, String contentType) throws AxisFault, JMSException
message
- the JMS message readmsgContext
- the Axis2 MessageContext to be populatedcontentType
- content type for the messageAxisFault
JMSException
public static Destination setReplyDestination(Destination replyDestination, Session session, Message message)
replyDestination
- the JMS Destination where the reply is expectedsession
- the session to use to create a temp Queue if a response is expected
but a Destination has not been specifiedmessage
- the JMS message where the final Destinatio would be set as the JMS ReplyTopublic static void setTransportHeaders(MessageContext msgContext, Message message) throws JMSException
msgContext
- the axis message contextmessage
- the JMS MessageJMSException
- on exceptionpublic static void loadTransportHeaders(Message message, MessageContext responseMsgCtx) throws AxisFault
message
- the JMS Message receivedresponseMsgCtx
- the axis message contextAxisFault
- on errorpublic static Map<String,Object> getTransportHeaders(Message message)
message
- the JMS messagepublic static MessageConsumer createConsumer(Session session, Destination dest, String messageSelector) throws JMSException
session
- JMS Session to usedest
- Destination for which the Consumer is to be createdmessageSelector
- the message selector to be used if anyJMSException
public static Destination createTemporaryDestination(Session session) throws JMSException
session
- the JMS Session to useJMSException
public static long getBodyLength(BytesMessage bMsg)
bMsg
- the JMS BytesMessagepublic static long getMessageSize(Message message) throws JMSException
message
- JMSException
public static <T> T lookup(Context context, Class<T> clazz, String name) throws NamingException
NamingException
public static Connection createConnection(ConnectionFactory conFac, String user, String pass, boolean jmsSpec11, Boolean isQueue) throws JMSException
conFac
- the ConnectionFactory to useuser
- optional user namepass
- optional passwordjmsSpec11
- should we use JMS 1.1 API ?isQueue
- is this to deal with a Queue?JMSException
- on errors, to be handled and logged by the callerpublic static Session createSession(Connection connection, boolean transacted, int ackMode, boolean jmsSpec11, Boolean isQueue) throws JMSException
connection
- the JMS Connectiontransacted
- should the session be transacted?ackMode
- the ACK mode for the sessionjmsSpec11
- should we use the JMS 1.1 API?isQueue
- is this Session to deal with a Queue?JMSException
- on errors, to be handled and logged by the callerpublic static MessageConsumer createConsumer(Session session, Destination destination, Boolean isQueue, String subscriberName, String messageSelector, boolean pubSubNoLocal, boolean isDurable, boolean jmsSpec11) throws JMSException
session
- JMS sessiondestination
- the DestinationisQueue
- is the Destination a queue?subscriberName
- optional client name to use for a durable subscription to a topicmessageSelector
- optional message selectorpubSubNoLocal
- should we receive messages sent by us during pub-sub?isDurable
- is this a durable topic subscription?jmsSpec11
- should we use JMS 1.1 API ?JMSException
- on errors, to be handled and logged by the callerpublic static MessageProducer createProducer(Session session, Destination destination, Boolean isQueue, boolean jmsSpec11) throws JMSException
session
- JMS sessiondestination
- the DestinationisQueue
- is the Destination a queue?jmsSpec11
- should we use JMS 1.1 API ?JMSException
- on errors, to be handled and logged by the callerpublic static String getDestinationTypeAsString(int destType)
destType
- the destination type indicator intpublic static Destination lookupDestination(Context context, String destinationName, String destinationType) throws NamingException
context
- the Context to lookupdestinationName
- name of the destination to be looked updestinationType
- type of the destination to be looked upNamingException
Copyright © 2004-2015 The Apache Software Foundation. All Rights Reserved.