|
From: Patrick Y. <kc...@ce...> - 2004-06-07 11:30:45
|
If you know it is safe to turn off the poller, you can try to call
request.enablePoller(false) to shut down it.
Regards, -Patrick
Simen Andre Skjervum wrote:
>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
>| onMessage() method in MessageListener, Hermes client will create a
>| polling thread to poll for received message periodically. The polled
>| 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.
>
>Basicly what I do is:
>
>messageQueue = new MessageQueue(); // class implementing MessageListener
>
>ac = new ApplicationContext(cpa, messageId, service, "*" );
>request = new Request(ac, partnerUrl, messageQueue, transportType);
>craftedMessage = createMessage( messageId, EnquiryPayload, action ); // creates message with given payload
>request.sendReliably( craftedMessage, false );
>
>do {
>
>response = messageQueue.receiveMessage();
>conversationId = response.getMessageHeader().getConversationId();
>refToMessageId = response.getMessageHeader().getRefToMessageId();
>
>} while (!messageId.equals(refToMessageId));
>
>|
>| To cut down the loading of these polling activities, you can tune the
>| polling interval in msh_client.properties.xml. Or you can use other
>| message delivery modes to eliminate polling activities altogether.
>| 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?
>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
>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 = new LinkedList();
> public synchronized void onMessage(EbxmlMessage ebxmlMessage) {
> queue.add(ebxmlMessage);
> notifyAll();
> }
> public synchronized EbxmlMessage receiveMessage() throws InterruptedException {
> while (queue.isEmpty()) {
> wait();
> }
> return (EbxmlMessage) queue.remove(0);
> }
> public URL getClientUrl() {
> return null;
> }
> }
>
>|
>| Regards, -Patrick
>|
>|
>| Simen Andre Skjervum wrote:
>|
>| >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:
>| >SELECT MessageStore.c_messageid, MessageInfo.c_conversationid,
>| >MessageStore.c_filename, MessageStore.c_sequencenumber FROM
>| >MessageStore, MessageInfo WHERE
>| >MessageStore.c_messageid=MessageInfo.c_messageid AND
>| >MessageStore.c_sequencenumber>=-9998 AND MessageStore.c_cpaid='*' AND
>| >MessageStore.c_conversationid='*' AND MessageStore.c_service='*' AND
>| >MessageStore.c_action='*' AND MessageStore.c_state>=-7 AND
>| >MessageStore.c_state<=-5
>| >
>| >Looking in to msh.log I see loads of this:
>| >2004-04-30 11:03:18,165 INFO [http8080-Processor2]: Process command: Get
>| >message (32)
>| >2004-04-30 11:03:18,166 DEBUG [http8080-Processor2]: =>
>| >MessageServiceHandler.processCommand
>| >2004-04-30 11:03:18,166 DEBUG [http8080-Processor2]: =>
>| >MessageServiceHandler.getMessage
>| >2004-04-30 11:03:18,166 DEBUG [http8080-Processor2]: =>
>| >MessageServiceHandler.getNextUndeliveredMessage
>| >2004-04-30 11:03:18,167 DEBUG [http8080-Processor2]: =>
>| >MessageServer.getUndeliveredMessages
>| >2004-04-30 11:03:18,167 DEBUG [http8080-Processor2]: =>
>| >DbConnectionPool.getConnection
>| >2004-04-30 11:03:18,167 DEBUG [http8080-Processor2]: <=
>| >DbConnectionPool.getConnection
>| >2004-04-30 11:03:18,196 DEBUG [http8080-Processor2]: <=
>| >MessageServer.getUndeliveredMessages
>| >2004-04-30 11:03:18,196 DEBUG [http8080-Processor2]: <=
>| >MessageServiceHandler.getNextUndeliveredMessage with no message
>| >2004-04-30 11:03:18,196 DEBUG [http8080-Processor2]: => Transaction.commit
>| >(txID: #1530)
>| >2004-04-30 11:03:18,197 DEBUG [http8080-Processor2]: =>
>| >DbConnectionPool.freeConnection
>| >2004-04-30 11:03:18,197 DEBUG [http8080-Processor2]: <=
>| >DbConnectionPool.freeConnection
>| >2004-04-30 11:03:18,197 DEBUG [http8080-Processor2]: <= Transaction.commit
>| >2004-04-30 11:03:18,198 DEBUG [http8080-Processor2]: <=
>| >MessageServiceHandler.getMessage
>| >2004-04-30 11:03:18,198 DEBUG [http8080-Processor2]: <=
>| >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?
>| >
>| >
>| >
>|
>|
>|
>| -------------------------------------------------------
>| This SF.Net email is sponsored by: Oracle 10g
>| Get certified on the hottest thing ever to hit the market... Oracle 10g.
>| Take an Oracle 10g class now, and we'll give you the exam FREE.
>| http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
>| _______________________________________________
>| ebxmlms-general mailing list
>| ebx...@li...
>| https://lists.sourceforge.net/lists/listinfo/ebxmlms-general
>
>
>
|