|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.openeai.OpenEaiObject
|
+--org.openeai.jms.consumer.PubSubMessageBalancer
This class is used by all PubSubConsumers to balance multiple instances of sync consumers. Since PubSub consumers all consume every message delivered to a topic (unlike PointToPointConsumers consuming from a Queue) they need a way to determine if another consumer is already processing the message. This is accomplished via this class and a property on the JMS Message (MESSAGE_ID) which popultated when the message is published from the source by the OpenEAI foundation APIs.
This MESSAGE_ID is unique among all messages published and is maintained automatically by the OpenEAI message production foundation (PubSubProducers and JMS Message Objects).
This particular Balancer uses a pre-defined database repository to store the MESSAGE_IDs and to determine if another consumer is processing or has processed the message.
| Field Summary |
| Fields inherited from class org.openeai.OpenEaiObject |
logger |
| Constructor Summary | |
PubSubMessageBalancer(DbConnectionPoolConfig dbConfig)
This is the constructor used by PubSubConsumers when they initialize themselves. |
|
| Method Summary | |
boolean |
canConsumerProcess(java.lang.String messageId)
This is the method called by the PubSubConsumer to determine if it's safe for this consumer to process the message it consumed. |
| Methods inherited from class org.openeai.OpenEaiObject |
addLog4jProperty, getAppName, getDebug, getFromAddr, getLog4jProperties, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PubSubMessageBalancer(DbConnectionPoolConfig dbConfig)
throws java.io.IOException
| Method Detail |
public final boolean canConsumerProcess(java.lang.String messageId)
throws java.sql.SQLException
java.sql.SQLException - if errors occur querying for the id after a failed insert.
NOTE: if any failures occur, the consumer will process the message because at that
point it doesn't know if another consumer's processing the message so it must
for safeties sake.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||