|
From: Simen A. S. <ssk...@no...> - 2004-06-01 11:21:10
|
On Sat, May 29, 2004 at 11:10:55AM +0800, Patrick Yee wrote:
| Hi,
| Have you written a Hermes client to receive messages? If you implement=20
| onMessage() method in MessageListener, Hermes client will create a=20
| polling thread to poll for received message periodically. The polled=20
| message will then be passed to you via the onMessage() method.
Yes, I use a serlvet client to send and receive messages as a synchronous=
service,
to query a remote msh and backend system. Now I understand that the
polling threads don't terminate, and that is why I experiance
performance problems.=20
Basicly what I do is:
messageQueue =3D new MessageQueue(); // class implementing MessageListene=
r
ac =3D new ApplicationContext(cpa, messageId, service, "*" );
request =3D new Request(ac, partnerUrl, messageQueue, transportType);
craftedMessage =3D createMessage( messageId, EnquiryPayload, action ); /=
/ creates message with given payload
request.sendReliably( craftedMessage, false );
do {
response =3D messageQueue.receiveMessage();
conversationId =3D response.getMessageHeader().getConversationId();
refToMessageId =3D response.getMessageHeader().getRefToMessageId();
} while (!messageId.equals(refToMessageId));
|=20
| To cut down the loading of these polling activities, you can tune the=20
| polling interval in msh_client.properties.xml. Or you can use other=20
| message delivery modes to eliminate polling activities altogether.=20
| Please see the documentation for more information. Thanks.
Could you provide examples of how I can use other message delivery
modes to eliminate polling activities?=20
E.g Can the client receive the messages directly without polling ?
Or maybe help me out on how I can properly terminate the polling threads=20
after the servlet has done it's job. That should solve my problem.
/* Heres the MessageQueue class I use:
public class MessageQueue implements MessageListener {
private List queue =3D new LinkedList();
public synchronized void onMessage(EbxmlMessage ebxmlMess=
age) {
queue.add(ebxmlMessage);
notifyAll();
}
public synchronized EbxmlMessage receiveMessage() throws =
InterruptedException {
while (queue.isEmpty()) {
wait();
}
return (EbxmlMessage) queue.remove(0);
}
public URL getClientUrl() {
return null;
}
}
|=20
| Regards, -Patrick
|=20
|=20
| Simen Andre Skjervum wrote:
|=20
| >Hello,
| >
| >I have a test environment running Hermes (ebms2) MSH v.pre-1.0.0.0. I
| >have made a servlet using msh as part of an ordering system with
| >a supplier. I could need some advice on how to better control the msh.
| >
| >When using the Servlet Heavily I encounter some serious performance
| >issue with the mysql db ( I use mysql as a msh database ).
| >The performance issue is due to some queries running from the msh
| >like:=20
| >SELECT MessageStore.c_messageid, MessageInfo.c_conversationid,
| >MessageStore.c_filename, MessageStore.c_sequencenumber FROM
| >MessageStore, MessageInfo WHERE
| >MessageStore.c_messageid=3DMessageInfo.c_messageid AND
| >MessageStore.c_sequencenumber>=3D-9998 AND MessageStore.c_cpaid=3D'*' =
AND
| >MessageStore.c_conversationid=3D'*' AND MessageStore.c_service=3D'*' A=
ND
| >MessageStore.c_action=3D'*' AND MessageStore.c_state>=3D-7 AND
| >MessageStore.c_state<=3D-5
| >
| >Looking in to msh.log I see loads of this:
| >2004-04-30 11:03:18,165 INFO [http8080-Processor2]: Process command: =
Get=20
| >message (32)
| >2004-04-30 11:03:18,166 DEBUG [http8080-Processor2]: =3D>=20
| >MessageServiceHandler.processCommand
| >2004-04-30 11:03:18,166 DEBUG [http8080-Processor2]: =3D>=20
| >MessageServiceHandler.getMessage
| >2004-04-30 11:03:18,166 DEBUG [http8080-Processor2]: =3D>=20
| >MessageServiceHandler.getNextUndeliveredMessage
| >2004-04-30 11:03:18,167 DEBUG [http8080-Processor2]: =3D>=20
| >MessageServer.getUndeliveredMessages
| >2004-04-30 11:03:18,167 DEBUG [http8080-Processor2]: =3D>=20
| >DbConnectionPool.getConnection
| >2004-04-30 11:03:18,167 DEBUG [http8080-Processor2]: <=3D=20
| >DbConnectionPool.getConnection
| >2004-04-30 11:03:18,196 DEBUG [http8080-Processor2]: <=3D=20
| >MessageServer.getUndeliveredMessages
| >2004-04-30 11:03:18,196 DEBUG [http8080-Processor2]: <=3D=20
| >MessageServiceHandler.getNextUndeliveredMessage with no message
| >2004-04-30 11:03:18,196 DEBUG [http8080-Processor2]: =3D> Transaction.=
commit=20
| >(txID: #1530)
| >2004-04-30 11:03:18,197 DEBUG [http8080-Processor2]: =3D>=20
| >DbConnectionPool.freeConnection
| >2004-04-30 11:03:18,197 DEBUG [http8080-Processor2]: <=3D=20
| >DbConnectionPool.freeConnection
| >2004-04-30 11:03:18,197 DEBUG [http8080-Processor2]: <=3D Transaction.=
commit
| >2004-04-30 11:03:18,198 DEBUG [http8080-Processor2]: <=3D=20
| >MessageServiceHandler.getMessage
| >2004-04-30 11:03:18,198 DEBUG [http8080-Processor2]: <=3D=20
| >MessageServiceHandler.processCommand
| >
| >These keeps running on even after I stop using the servlet.
| >When I stop-start tomcat they go away until I start using the servlet
| >again. Obviously(?) I need to find a way to tell the
| >MessageServiceHandler to stop polling for messages, but I can't seem
| >to get at it. Can anyone advice me how to solve this?
| >
| >=20
| >
|=20
|=20
|=20
| -------------------------------------------------------
| This SF.Net email is sponsored by: Oracle 10g
| Get certified on the hottest thing ever to hit the market... Oracle 10g=
.=20
| Take an Oracle 10g class now, and we'll give you the exam FREE.
| http://ads.osdn.com/?ad_id=3D3149&alloc_id=3D8166&op=3Dclick
| _______________________________________________
| ebxmlms-general mailing list
| ebx...@li...
| https://lists.sourceforge.net/lists/listinfo/ebxmlms-general
--=20
Med vennlig hilsen / Best Regards / Cordiali saluti
Tiscali AS - Simen Skjervum (Amministratore di sistema)
Postboks 598, Sk=F8yen - N-0214 Oslo - Norway
Tel. (+47) 24 11 24 00 - Fax (+47) 24 11 24 11
|