public class Helper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
BUNDLE_CF_PROP |
static String |
BUNDLE_CLEANER_PERIOD_PROP |
static String |
BUNDLE_IDLE_TIMEOUT_PROP |
static String |
BUNDLE_JNDI_FACTORY_HOST_PROP |
static String |
BUNDLE_JNDI_FACTORY_INITIAL_PROP |
static String |
BUNDLE_JNDI_FACTORY_PORT_PROP |
private org.osgi.framework.BundleContext |
bundleContext |
private String |
cfName |
private static AtomicLong |
counter |
private long |
globalIdleTimeout |
private static Helper |
helper |
private InitialContext |
ictx |
private Properties |
jndiProps |
static org.objectweb.util.monolog.api.Logger |
logger |
private HashMap<String,RestClientContext> |
restClientCtxs |
private HashMap<String,SessionContext> |
sessionCtxs |
Modifier | Constructor and Description |
---|---|
private |
Helper() |
Modifier and Type | Method and Description |
---|---|
void |
acknowledgeAllMsg(String consName) |
void |
acknowledgeMsg(String consName,
long id) |
void |
close(String clientId) |
void |
closeAll() |
void |
closeSessionCtx(String ctxName) |
void |
commit(String name) |
Message |
consume(String consName,
long timeout,
boolean noLocal,
boolean durable,
boolean shared,
String name,
long msgId) |
String |
createClientId() |
String |
createConsumer(String userName,
String password,
String clientId,
String consName,
Destination dest,
int sessionMode,
String messageSelector,
boolean noLocal,
boolean durable,
boolean shared,
String name,
String destName,
boolean isQueue,
long idleTimeout) |
String |
createConsumerId() |
String |
createProducer(String userName,
String password,
String clientId,
String prodName,
Destination dest,
int sessionMode,
int deliveryMode,
long deliveryDelay,
String correlationID,
int priority,
long timeToLive,
String destName,
boolean isQueue,
long idleTimeout)
Create a producer
|
String |
createProducerId() |
RestClientContext |
getClientContext(String id) |
static Helper |
getInstance() |
HashMap<String,RestClientContext> |
getRestClientCtxs() |
SessionContext |
getSessionCtx(String name) |
private Object |
getValue(Map map,
String key) |
Object |
lookup(String name) |
Destination |
lookupDestination(String destName)
Lookup the destination
|
void |
rollback(String name) |
long |
send(String prodName,
String type,
Map<String,Object> jmsHeaders,
Map<String,Object> jmsProps,
Object jmsBody,
int deliveryMode,
long deliveryTime,
int priority,
long timeToLive,
String correlationID) |
void |
setConnectionFactoryName(String cfName) |
void |
setGlobalProperties(org.osgi.framework.BundleContext bundleContext) |
private void |
setMapMessage(Map<String,Object> jsonMap,
MapMessage msg) |
public static final String BUNDLE_CF_PROP
public static final String BUNDLE_JNDI_FACTORY_INITIAL_PROP
public static final String BUNDLE_JNDI_FACTORY_HOST_PROP
public static final String BUNDLE_JNDI_FACTORY_PORT_PROP
public static final String BUNDLE_IDLE_TIMEOUT_PROP
public static final String BUNDLE_CLEANER_PERIOD_PROP
public static org.objectweb.util.monolog.api.Logger logger
private static final AtomicLong counter
private static Helper helper
private InitialContext ictx
private HashMap<String,RestClientContext> restClientCtxs
private HashMap<String,SessionContext> sessionCtxs
private String cfName
private org.osgi.framework.BundleContext bundleContext
private long globalIdleTimeout
private Properties jndiProps
public static Helper getInstance()
public void setGlobalProperties(org.osgi.framework.BundleContext bundleContext) throws NamingException
NamingException
public HashMap<String,RestClientContext> getRestClientCtxs()
public void setConnectionFactoryName(String cfName)
cfName
- the connection factory namepublic void close(String clientId)
clientId
- the client idpublic void closeSessionCtx(String ctxName)
ctxName
- the producer or consumer namepublic Destination lookupDestination(String destName) throws NamingException
destName
- the destination nameNamingException
public Object lookup(String name) throws NamingException
NamingException
public String createProducer(String userName, String password, String clientId, String prodName, Destination dest, int sessionMode, int deliveryMode, long deliveryDelay, String correlationID, int priority, long timeToLive, String destName, boolean isQueue, long idleTimeout) throws Exception
userName
- the user namepassword
- the passwordclientId
- the client idprodName
- the producer namedest
- the JMS destinationsessionMode
- the session modedeliveryMode
- the delivery modedeliveryDelay
- the delivery delaycorrelationID
- the correlation idpriority
- the prioritytimeToLive
- the time to livedestName
- need for the jms createisQueue
- idleTimeout
- Exception
public String createConsumer(String userName, String password, String clientId, String consName, Destination dest, int sessionMode, String messageSelector, boolean noLocal, boolean durable, boolean shared, String name, String destName, boolean isQueue, long idleTimeout) throws Exception
Exception
private void setMapMessage(Map<String,Object> jsonMap, MapMessage msg) throws Exception
Exception
public long send(String prodName, String type, Map<String,Object> jmsHeaders, Map<String,Object> jmsProps, Object jmsBody, int deliveryMode, long deliveryTime, int priority, long timeToLive, String correlationID) throws Exception
prodName
- type
- jmsHeaders
- jmsProps
- jmsBody
- deliveryMode
- deliveryTime
- priority
- timeToLive
- correlationID
- Exception
public Message consume(String consName, long timeout, boolean noLocal, boolean durable, boolean shared, String name, long msgId) throws Exception
Exception
public String createClientId()
public String createProducerId()
public String createConsumerId()
public SessionContext getSessionCtx(String name)
public RestClientContext getClientContext(String id)
Copyright © 2016 ScalAgent D.T.. All Rights Reserved.