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 Process Server (WID/WPS/WAS+) » MQ Function Selector

Post new topic  Reply to topic
 MQ Function Selector « View previous topic :: View next topic » 
Author Message
fitzcaraldo
PostPosted: Thu Jun 12, 2008 5:34 pm    Post subject: MQ Function Selector Reply with quote

Voyager

Joined: 05 May 2003
Posts: 98

Newbie design question - WESB V6.1

We have an application that sends 5 different XML message types to a single queue and we are thinking about how to best implement the ESB Export. These are MQ messages - not JMS - no header other than MQMD. What options do we have to select the correct function - ie function selector? It appears the only way we can determine one message type from the other is to look at the name of the XML document of each. Does that mean we need to write a custom function selector? Any other options we should consider? Could we create a generic BO with the XML doc as a string, pass it to a mediation module and then cast to the correct BO there?
Back to top
View user's profile Send private message
Liquid
PostPosted: Tue Jun 17, 2008 3:17 am    Post subject: Re: MQ Function Selector Reply with quote

Acolyte

Joined: 08 Sep 2004
Posts: 52
Location: Hungary, Europe

I've used a custom function selector for the same issue so far. It works fine, but as I'am also a newbe in WPS more appropriate sollutions
may exists too.

Yours,
Liquid


fitzcaraldo wrote:
Newbie design question - WESB V6.1
...
of each. Does that mean we need to write a custom function selector? Any other options we should consider? Could we create a generic BO with the XML doc as a string, pass it to a mediation module and then cast to the correct BO there?
Back to top
View user's profile Send private message
andrew.stewart
PostPosted: Wed Jun 18, 2008 5:26 pm    Post subject: Reply with quote

Newbie

Joined: 10 Apr 2008
Posts: 6

fitzcaraldo,

am currently on a project facing the exact same problem, here's what we did:

Our original solution was to write a custom data binding and stuff the contents of the MQ body into a string. A subsequent Java node inspected the XML content within the string to determine the BO type, then serialized the XML into the BO type before passing it on for transformation etc. It worked, but it wasn't pretty.

After much reading of developerWorks material etc we were pretty sure the correct way to handle this situation was to implement a custom function selector. By inspecting the message within the custom function selector to determine the message type, we then returned a function name to handle that specific message type. The default XMLDataBinding then correctly casts the message as the BO type defined as the input to the function on the interface. This is a much neater solution and we're confident this is the correct design pattern.

Start by extending the MQFunctionSelector class:

public class CustomMQFunctionSelector extends MQFunctionSelector {

public CCBMQFunctionSelector() {
super();
}

public String generateEISFunctionName(MQMD md, String bodyFormat, List headers, MQDataInputStream is) throws IOException, SelectorException {

// inspect message and determine type
// return function name to handle specific message type
return "handleMessageTypeExample";

}
}

hope that helps,

andrew.
Back to top
View user's profile Send private message
Liquid
PostPosted: Wed Jun 25, 2008 6:19 am    Post subject: Reply with quote

Acolyte

Joined: 08 Sep 2004
Posts: 52
Location: Hungary, Europe

andrew.stewart wrote:
name to handle that specific message type. The default XMLDataBinding then correctly casts the message as the BO


I tried to use XMLDataBinding as you mentioned instead of the my previously used custom data binding java code.

So, in the Export MQ Binding -> Method bindings -> Input data binding configuration selection box I selected the com.ibm.websphere.sca.mq.data.impl.MQDataBindingImplXML class for the appropriate interface method, but I got an exception which shows that the data binding class could not load the xml content of the mq message:

/...
java.io.IOException: Error reading XML
at com.ibm.ws.bo.service.BOXMLSerializerImpl.load(BOXMLSerializerImpl.java:214)
.../

The mq message data is a pure xml message. Shall I create a custom data binding configuration with a com.ibm.ws.sca.databinding.impl.DataBindingImplXML class? Where can I find some information about the WPS binding classes?

Thanks in advance,
Liquid
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 Process Server (WID/WPS/WAS+) » MQ Function Selector
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.