|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openeai.OpenEaiObject
org.openeai.jms.consumer.PubSubMessageBalancer
public class 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)
Deprecated. use canConsumerProcess(String appId, String messageId) instead. |
boolean |
canConsumerProcess(java.lang.String appId,
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 |
|---|
getAppName, getDebug, getFromAddr, 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
dbConfig - DbConnectionPoolConfig used to instantiate the EnterpriseConnectionPool associated
to this Balancer.
java.io.IOException| Method Detail |
|---|
public final boolean canConsumerProcess(java.lang.String messageId)
throws java.sql.SQLException
messageId - String the message id being checked that was pulled from the JMS message
consumed by the consumer.
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.
public final boolean canConsumerProcess(java.lang.String appId,
java.lang.String messageId)
throws java.sql.SQLException
messageId - String the message id being checked that was pulled from the JMS message
consumed by the consumer.appId - String the application id that the message is being processed on
behalf of. i.e., the application consuming the message.
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 | |||||||||