[jboss-dev-forums] [Design of JBoss ESB] - Re: ESB messages API and design considerations
mark.little@jboss.com
do-not-reply at jboss.com
Fri Sep 12 07:41:58 EDT 2008
"karypid" wrote : I'm a newcomer to JBossESB and am having trouble understanding the API and rationale behind message factories and the body. I would appreciate some feedback to these very basic questions:
|
| I set a breakpoint in my message composer code and using the variable inspector I observed that:
|
You know the code is available to look through too :-) ?
anonymous wrote :
|
| When you use the XMLMessageFactory to create a text message, it creates an entry in the table of objects that belong to the message body. The key used is "org.jboss.soa.esb.message.payload.text", which is the constant value for TextBody.DEFAULT_LOCATION.
| If you simply use a MessageFactory, an entry is created in the message objects table under the key Body.DEFAULT_LOCATION (whose value is "org.jboss.soa.esb.message.defaultEntry").
|
|
Yes, plus this is all documented in the Programmers Guide.
anonymous wrote :
| Now, all actions that pre-ship with the JBoss ESB expect the message body to reside at Body.DEFAULT_LOCATION. So, if you create your message using an XMLMessageFactory, all these goodies are useless, because they can't "see" your message body.
|
These factories and body types were added quite late in the development of the 4.x codebase, primarily as a way of trying to simplify the whole message approach. However, we ended up simplifying the message interaction in another way entirely, so none of the out-of-the-box actions make use of them. But that's not to say that you can't create your own actions that use them. Once again, that's kind of the benefit of having the source or having a pluggable architecture for service composition: if you don't like what you get then you can replace/augment it.
anonymous wrote :
| My understanding was that the basic things you need to decide in order to create your message, are:
|
| The kind of serialization you want to use withing the ESB: this means you must choose either XMLMessageFactory or SerializedMessageFactory.
| What will be in the message body. This means that you must choose a TextBody, ObjectBody, BytesBody, or MapBody).
|
Have you checked out the Programmers Guide? As I said, it does go into this in some detail.
But the majority illustrations and examples for message interaction is not to go via these Body types at all. That's not to say that you have to develop in that way yourself. But as you've pointed out, the out-of-the-box actions won't be keying on the same points in the payload.
anonymous wrote :
| So, here's the list of things that don't make sense:
|
| Why is MessageFactory non-abstract? Shouldn't one be forced to use XML / Java serialization (or roll their own)? I would've expected it to be abstract and for XMLMessageFactory and SerializedMessageFactory to extend it. If you want some other serialization, you would need to extend MessageFactory and implement the message construction methods.
|
Erm, MessageFactory is abstract.
| public abstract class MessageFactory
|
anonymous wrote :
| Since MessageFactory is (evidently) non-abstract, what serialization does it use?
|
It's evidently abstract ;-) Which code are you looking at?
anonymous wrote :
| I would've expected the message factories (XMLMessageFactory and SerializedMessageFactory) to place the body under the Body.DEFAULT_LOCATION key. Why don't they do that?
|
The current approach is to put the content in a well-defined location within the payload that isn't the DEFAULT_LOCATION in order that they can co-exist with existing code.
anonymous wrote :
| In fact, what's the point of having various message body types (TextBody, ObjectBody, etc)? Is it to improve legibility of the code? (admittedly, writing "TextBody" immediately reveals to the developer reading it what one is working with text here)
|
The request we had at the time was a suggestion to mirror the JMS message types, since many users know and understand that approach.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4176096#4176096
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4176096
More information about the jboss-dev-forums
mailing list