Re: Two instances

158 views
Skip to first unread message

Allan Randall

unread,
May 11, 2013, 1:35:39 AM5/11/13
to cecid-...@googlegroups.com
Hermes polls the database for outbound messages. If you have two instances sharing a database then you will run into problems.

From memory you can run multiple instances using the same database provided that you only have one host running the OutboxCollector. This of course means that only one host can send outgoing messages.

The configuration for this resides in: plugins/hk.hku.cecid.ebms/conf/hk/hku/cecid/ebms/spa/conf/outbox-collector.module.xml

You can disable the module by commenting the 'outbox-collector.module.xml' entry in: plugins/hk.hku.cecid.ebms/conf/hk/hku/cecid/ebms/spa/conf/ebms.module-group.xml

-Allan.

On Friday, May 10, 2013 9:01:25 PM UTC+10, ago...@gmail.com wrote:
Hi, Is it possible to run two instances of Hermes ebXML gateway in parallel pointing to the same database? It looks like we can't but just wanted an opnion. Or is there a way around that?

Thanks

ago...@gmail.com

unread,
May 13, 2013, 4:47:30 AM5/13/13
to cecid-...@googlegroups.com
cheers Allan, I'll have a look at outbox collector module. Would you think they both will be able to process the incoming messages though? Actually we are currently trying to scale and automated failover to other node in case of a failure. Would you think it is possible to do automated failover? It appears that we'll have to manually enable outbox collector in this case?

Thanks for responding.

Allan Randall

unread,
May 13, 2013, 7:58:03 PM5/13/13
to cecid-...@googlegroups.com
Two instances should be able to process incoming messages using the same database without any trouble provided that the message_id is unique.

In regards to two instances sending outgoing messages and/or failover. I have seen some people suggest/use the database in an attempt to achieve this.

The SQL statement that is used to find messages in the outbox is defined in
plugins/hk.hku.cecid.ebms/conf/hk/hku/cecid/ebms/spa/conf/ebms.[db].dao.xml.

<dao name="hk.hku.cecid.ebms.spa.dao.OutboxDAO">
  <class>hk.hku.cecid.ebms.spa.dao.OutboxDataSourceDAO</class>
  <parameter name="table" value="outbox" />
  <parameter name="key" value="message_id" />
  <parameter type="column" name="message_id" value="messageId" />
  <parameter type="column" name="retried" value="retried" />
  <parameter type="finder" name="select_outbox" value="select * from outbox" />
</dao>

You could modify the database table and/or the query to get the behaviour you want. For a more robust solution you would probably have to get your hands dirty in the code.

-Allan.

ago...@gmail.com

unread,
May 14, 2013, 7:06:52 AM5/14/13
to cecid-...@googlegroups.com
Thank you for your reply. If we modify the table name in this xml file do we need to modify that table name somewhere else as well that populates this table?

Allan Randall

unread,
May 14, 2013, 9:41:53 PM5/14/13
to cecid-...@googlegroups.com
The xml file I mentioned earlier contains all the details that Hermes uses to insert, delete, update and select data from the database.

You will have to update all references to the table name "outbox" in the file if you wanted to change the table name in the database.

ago...@gmail.com

unread,
May 15, 2013, 11:36:57 AM5/15/13
to cecid-...@googlegroups.com
Thanks for responding.. Ok what I've tried is started two instances of hermes A & B. A has table name outbox and for B table name is outbox_1. Sent a message to A which processed the message and sent to thirdparty fine. But when an Acknowledgement was sent back by thirdparty to A, I seen an exception in B as following. Any idea how to fix this? Thanks

2013-05-15 16:30:41,313 ERROR [hk.hku.cecid.ebms.spa] (Thread-30) Error in storing message to inbox
hk.hku.cecid.piazza.commons.dao.DAOException: Error in executing hk.hku.cecid.ebms.spa.dao.InboxDataSourceDAO::Process@abc8ee
        by hk.hku.cecid.piazza.commons.dao.DAOException: Error in executing update: INSERT INTO inbox (order_no, message_id) VALUES (?,?)
        by hk.hku.cecid.piazza.commons.dao.DAOException: Error occurred when executing update at row 0 of the specified parameter array
        by com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry 'response-1368631840923-4516325796575306752' for key 1
        at hk.hku.cecid.piazza.commons.dao.ds.DataSourceProcess.start(DataSourceProcess.java:97)
        at hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeUpdate(DataSourceDAO.java:588)
        at hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeUpdate(DataSourceDAO.java:548)
        at hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.executeUpdate(DataSourceDAO.java:528)
        at hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.create(DataSourceDAO.java:626)
        at hk.hku.cecid.piazza.commons.dao.ds.DataSourceDAO.create(DataSourceDAO.java:610)
        at hk.hku.cecid.ebms.spa.task.InboxTask.execute(InboxTask.java:57)
        at hk.hku.cecid.piazza.commons.module.ActiveThread.run(ActiveThread.java:90)
        at java.lang.Thread.run(Unknown Source)
Caused by: hk.hku.cecid.piazza.commons.dao.DAOException: Error in executing update: INSERT INTO inbox (order_no, message_id) VALUES (?,?)
        by hk.hku.cecid.piazza.commons.dao.DAOException: Error occurred when executing update at row 0 of the specified parameter array
        by com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry 'response-1368631840923-4516325796575306752' for key 1
        at hk.hku.cecid.piazza.commons.dao.ds.DataSourceUpdate.doTransaction(DataSourceUpdate.java:110)
        at hk.hku.cecid.piazza.commons.dao.ds.DataSourceProcess.start(DataSourceProcess.java:89)
        ... 8 more
Caused by: hk.hku.cecid.piazza.commons.dao.DAOException: Error occurred when executing update at row 0 of the specified parameter array
        by com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry 'response-1368631840923-4516325796575306752' for key 1
        at hk.hku.cecid.piazza.commons.dao.ds.DataSourceUpdate.doTransaction(DataSourceUpdate.java:96)
        ... 9 more

Allan Randall

unread,
May 16, 2013, 11:50:58 PM5/16/13
to cecid-...@googlegroups.com
This error suggests that you have already received the message in the inbox or you have received a message with an identical ID.

877  3.1.6.1 MessageId Element 
878  The REQUIRED element MessageId is a globally unique identifier for each message conforming to 
879  MessageId [RFC2822].  

Who is the 3rd party in this case? Do you have control over it? You may want to setup a 3rd Hermes gateway for your testing initially so that you can control both ends.

-Allan.
Reply all
Reply to author
Forward
0 new messages