ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Using clearMessage in java plugin node

Post new topic  Reply to topic
 Using clearMessage in java plugin node « View previous topic :: View next topic » 
Author Message
vids
PostPosted: Sun Oct 24, 2004 10:50 pm    Post subject: Using clearMessage in java plugin node Reply with quote

Acolyte

Joined: 24 Mar 2003
Posts: 68
Location: CA, USA

Hi,

I'm trying to call clearMessage method in java plugin node and I get the exception com.ibm.broker.plugin.MbReadOnlyMessageException.

Here is how my code looks like...

MbMessage newMsg = new MbMessage(assembly.getMessage());
MbMessageAssembly newAssembly = new MbMessageAssembl (assembly, newMsg);

MbElement rootElement = newAssembly.getMessage().getRootElement();

//....
//...some code...
//....

MbOutputTerminal out = getOutputTerminal("out");

//...some code...

newMsg.clearMessage ();
out.propagate(newAssembly);

The exception is because of the newMsg.clearMessage(). Is there anything I need to do before calling clearMessage??

Thanks
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Oct 25, 2004 4:44 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Call newMessage on your newAssembly, not your old assembly.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vids
PostPosted: Mon Oct 25, 2004 8:54 am    Post subject: Reply with quote

Acolyte

Joined: 24 Mar 2003
Posts: 68
Location: CA, USA

Hi Jeff,

Did you mean replace newMsg.clearMessage() by newAssembly.getMessage().clearMessage() ??

I have already tried this. I get the below error:

Exception : [BIPv500:2310]BIP2310E: The broker is not capable of handling message of type '' on behalf of node '{1}'.

The message broker received a message that requires the handling of data of type '' but the broker does not have the capability to handle data of this type. This happened when processing a message on behalf of node '{1}'.

Check both the message being sent to be message broker and the configuration data for the node. References to the unsupported data type must be removed if the messages are to be processed by the broker. : Could not locate a suitable factory
StackTrace :
<com.ibm.broker.plugin.MbBrokerException source:BIPv500 key:2310 message:[BIPv500:2310]BIP2310E: The broker is not capable of handling message of type '' on behalf of node '{1}'.

The message broker received a message that requires the handling of data of type '' but the broker does not have the capability to handle data of this type. This happened when processing a message on behalf of node '{1}'.

Check both the message being sent to be message broker and the configuration data for the node. References to the unsupported data type must be removed if the messages are to be processed by the broker. : Could not locate a suitable factory >
at com.ibm.broker.plugin.MbOutputTerminal._propagate(Native Method)
at com.ibm.broker.plugin.MbOutputTerminal.propagate(MbOutputTerminal.java:126)
at ESMBaseJavaNode.evaluate(ESMBaseJavaNode.java:109)


Thanks
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Oct 25, 2004 9:14 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Code:
MbMessage newMsg = new MbMessage(assembly.getMessage());
MbMessageAssembly newAssembly = new MbMessageAssembly(assembly, newMsg);

I think this is wrong.

Code:
MbMessageAssembly newAssembly = new MbMessageAssembly (assembly, assembly.getMessage());
MbMessage newMsg = new MbMessage(newAssembly.getMessage());

I think this is right.

But it's been a while since I've done custom plug-ins. And it was for 2.1, not 5.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vids
PostPosted: Mon Oct 25, 2004 3:47 pm    Post subject: Reply with quote

Acolyte

Joined: 24 Mar 2003
Posts: 68
Location: CA, USA

Jeff,

I don't think there is a problem with the below code

MbMessage newMsg = new MbMessage(assembly.getMessage());
MbMessageAssembly newAssembly = new MbMessageAssembly(assembly, newMsg);

because I have referred other sample programs too.

Looks like the problem is because I'm calling clearMessage() before propagate.
I tried calling clearMessage() after propagate and it works okay.But I'm really
not sure if the clearMessage() has done the clean up job.

Now after making some code changes, this is what I'm noticing...


When we use clearMessage() before propagate, the message is backed out to the input
queue of the message flow and then it's moved to SYSTEM.DEAD.LETTER.QUEUE after the
backout count exceeds the threshold.

In java node, the print statements after the propagate are not printed and there is no
exception thrown.

In the flow, after the java node we put trace nodes to out terminal and failure termial.
Failure terminal is connected to Throw node and we have tryCatch and ErrorProcessing sub
flow which puts the message to the Error queue. The message is not going through any of
these two terminals and backs out to the input queue.


Here is how our code looks like....here the clearMessage() is called after the propagate.

########################################################################################
public abstract class BaseJavaNode extends MbNode implements MbNodeInterface, IMessageBrokerConstants {

public void evaluate(MbMessageAssembly pAssembly, MbInputTerminal pInTerminal) throws MbException {
try {


MbMessageAssembly l_outputAssembly = createOutputMessageAssembly(pAssembly);
MbElement l_message = getMessageElement(l_outputAssembly);

MbElement l_payload =l_message.getFirstElementByPath(m_payloadPath);


//...some code...
//...some code...


MbOutputTerminal l_out = getOutputTerminal(OUT_TERMINAL);
l_out.propagate(l_outputAssembly);
l_outputAssembly.getMessage().clearMessage();

} catch (Exception e) {// ...some code ....}
}

protected MbMessageAssembly createOutputMessageAssembly(MbMessageAssembly pMessageAssembly) throws MbException {
MbMessage newMsg = new MbMessage(pMessageAssembly.getMessage());
MbMessageAssembly l_outputAssembly = new MbMessageAssembly(pMessageAssembly, newMsg);

return l_outputAssembly;
}

/**
* Retrieve the top level message element from the MessageAssembly.
*/
protected MbElement getMessageElement(MbMessageAssembly pOutputAssembly) throws MbException {
MbMessage l_newMsg = pOutputAssembly.getMessage();
MbElement l_message = l_newMsg.getRootElement();

return l_message;
}

}

########################################################################################


When the clearMessage() is called after the propagate, there is no exception or backout messages and it works fine but
we are not sure if the clearMessage() is really doing the clean-up job.

If we print the l_outputAssembly using toString(), it just displays the referece as shown below which doen't really
say if the clearMessage() has done it's job.


(
Message:
com.ibm.broker.plugin.MbMessage@57b5b31

Local environment:
com.ibm.broker.plugin.MbMessage@2a639b31

Global environment:
com.ibm.broker.plugin.MbMessage@25a39b31

Exception list:
com.ibm.broker.plugin.MbMessage@25f71b31
)

Could you please let us know how to check if the clearMessage has done the clean-up job.

*************************************************************************************************8
Back to top
View user's profile Send private message
vids
PostPosted: Wed Oct 27, 2004 10:09 am    Post subject: Reply with quote

Acolyte

Joined: 24 Mar 2003
Posts: 68
Location: CA, USA

Hi,

If the message object is not deleted using clearMessage() function, the objects will not be freed until
the Garbage Collector is called.

In order to test if clearMessage() is doing its job.... dump a lot of messages to your input queue and
monitor the DataFlowEngine memory usage in task manager. Monitor and compare the memory usage with and
without clearMessage(). DFE memory keeps increasing when there is no clearMessage().
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Using clearMessage in java plugin node
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.