Package ru.bitel.bgbilling.kernel.event
Class Consumer
java.lang.Object
ru.bitel.bgbilling.kernel.event.MessageAdapter
ru.bitel.bgbilling.kernel.event.Consumer
- All Implemented Interfaces:
javax.jms.MessageListener
,EventListener<ru.bitel.bgbilling.kernel.event.common.Event>
public final class Consumer extends MessageAdapter implements javax.jms.MessageListener
Обработчик сообщения.
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
applicationName
protected EventListenerContext
eventListenerContext
MessageListener.onMessage(Message)
выполняется в одном потокеSession
.
Поэтому можно использовать один объектEventListenerContext
, если обработка в одном пакете.protected EventProcessor
eventProcessor
boolean
localSession
Fields inherited from class ru.bitel.bgbilling.kernel.event.MessageAdapter
deliveryMode, priority, session, timeToLive
-
Constructor Summary
Constructors Constructor Description Consumer(EventProcessor eventProcessor, javax.jms.Session session, int moduleId, int pluginId, java.lang.String destination, java.lang.String query, boolean queue, boolean noLocal, int deliveryMode, int priority, long timeToLive, boolean localSession, java.lang.Class<? extends ru.bitel.bgbilling.kernel.event.common.Event>... clazz)
Consumer(EventProcessor eventProcessor, javax.jms.Session session, java.lang.Class<? extends ru.bitel.bgbilling.kernel.event.common.Event> clazz, EventType type, int moduleId, int pluginId, java.lang.String destination, java.lang.String query, boolean setMessageListener, boolean localSession)
-
Method Summary
Modifier and Type Method Description void
close()
protected javax.jms.MessageConsumer
createConsumer(java.lang.String destination, java.lang.String query, boolean noLocal, boolean topic)
void
destroy()
void
notify(ru.bitel.bgbilling.kernel.event.common.Event e, EventListenerContext ctx)
void
onMessage(javax.jms.Message message)
protected boolean
onMessage0(javax.jms.Message message, EventListenerContext eventListenerContext, EventListener<ru.bitel.bgbilling.kernel.event.common.Event> listener)
<E extends ru.bitel.bgbilling.kernel.event.common.Event>
Ereceive()
<E extends ru.bitel.bgbilling.kernel.event.common.Event>
Ereceive(long timeout)
<E extends ru.bitel.bgbilling.kernel.event.common.Event>
EreceiveNoWait()
protected void
trySendReply(javax.jms.Message message, ru.bitel.bgbilling.kernel.event.common.Event e, java.lang.Exception ex)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
eventProcessor
-
applicationName
protected final java.lang.String applicationName -
eventListenerContext
MessageListener.onMessage(Message)
выполняется в одном потокеSession
.
Поэтому можно использовать один объектEventListenerContext
, если обработка в одном пакете. -
localSession
public final boolean localSession
-
-
Constructor Details
-
Consumer
public Consumer(EventProcessor eventProcessor, javax.jms.Session session, java.lang.Class<? extends ru.bitel.bgbilling.kernel.event.common.Event> clazz, EventType type, int moduleId, int pluginId, java.lang.String destination, java.lang.String query, boolean setMessageListener, boolean localSession) throws javax.jms.JMSException, javax.xml.bind.JAXBException- Throws:
javax.jms.JMSException
javax.xml.bind.JAXBException
-
Consumer
public Consumer(EventProcessor eventProcessor, javax.jms.Session session, int moduleId, int pluginId, java.lang.String destination, java.lang.String query, boolean queue, boolean noLocal, int deliveryMode, int priority, long timeToLive, boolean localSession, java.lang.Class<? extends ru.bitel.bgbilling.kernel.event.common.Event>... clazz) throws javax.jms.JMSException, javax.xml.bind.JAXBException- Throws:
javax.jms.JMSException
javax.xml.bind.JAXBException
-
-
Method Details
-
onMessage0
protected boolean onMessage0(javax.jms.Message message, EventListenerContext eventListenerContext, EventListener<ru.bitel.bgbilling.kernel.event.common.Event> listener) throws javax.jms.JMSException, javax.xml.bind.JAXBException, ru.bitel.bgbilling.common.BGException- Throws:
javax.jms.JMSException
javax.xml.bind.JAXBException
ru.bitel.bgbilling.common.BGException
-
onMessage
public void onMessage(javax.jms.Message message)- Specified by:
onMessage
in interfacejavax.jms.MessageListener
-
createConsumer
protected javax.jms.MessageConsumer createConsumer(java.lang.String destination, java.lang.String query, boolean noLocal, boolean topic) throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
trySendReply
protected final void trySendReply(javax.jms.Message message, ru.bitel.bgbilling.kernel.event.common.Event e, java.lang.Exception ex) throws javax.jms.JMSException, javax.xml.bind.JAXBException- Throws:
javax.jms.JMSException
javax.xml.bind.JAXBException
-
close
public void close() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
destroy
public void destroy() throws javax.jms.JMSException- Throws:
javax.jms.JMSException
-
receive
public <E extends ru.bitel.bgbilling.kernel.event.common.Event> E receive() throws ru.bitel.bgbilling.common.BGException- Throws:
ru.bitel.bgbilling.common.BGException
-
receive
public <E extends ru.bitel.bgbilling.kernel.event.common.Event> E receive(long timeout) throws ru.bitel.bgbilling.common.BGException- Throws:
ru.bitel.bgbilling.common.BGException
-
receiveNoWait
public <E extends ru.bitel.bgbilling.kernel.event.common.Event> E receiveNoWait() throws ru.bitel.bgbilling.common.BGException- Throws:
ru.bitel.bgbilling.common.BGException
-
notify
public void notify(ru.bitel.bgbilling.kernel.event.common.Event e, EventListenerContext ctx) throws ru.bitel.bgbilling.common.BGException- Specified by:
notify
in interfaceEventListener<ru.bitel.bgbilling.kernel.event.common.Event>
- Throws:
ru.bitel.bgbilling.common.BGException
-