POSOS: Plain Old Services Objects in JBoss ESB |
(2008年09月05日)发表于Aggregated feed of all JBoss feeds |
|
What? One more buzzword? You can complain with Burr Sutter, he is the guy that created this one for what some customers are wondering and they asked me how do that possible in JBossESB! The question is: "We would like use or reuse as easy as possible my just plain Pojos or "legacy beans" acting as ESB Actions configured in the listeners from protocol's providers in ESB. ESB Traditional Actions for Experienced Developers...Easy Pojos for non-experienced ones When you are writing your ESB Action classes, you have some rules to follow, for instance: a) extends AbstractActionLifecycle or , b) A Constructor with a ConfigTree object as a parameter , c) The process methods must returns a Message as well as you need a Message parameter using this type, so your simplest ESB Action is not that easy for non-experienced ESB Action developers. Ok, Show me this POJO that can run inside JBoss ESB See the following pojo: Easy right? See the changes I did to enable this simple POJO as an Action Processor for a Listener in ESB, basically creating two annotations: @In and @MessageParam, which can tell me which methods from the pojo I have to invoke from my processor method in the action, as well as the parameters that I can get via the attributes stored in the Message.Body : Basically, what I did was a first action, that is traditional action, where I put a value in the message body identified by the name "s", which is the value from "name" in the annotation @MessageParam, so the value will be transfered for my methods as a parameter properly, my action is very simpple as you can see in the following image: On this point, I am using a strategy similar you can see at any regular Web application, which a portion can store some information into some context that will be accessible when necessary. The convention here is that, I am telling that the annotation @In (like Seam) in the method must be processed into the BUS, in addition, the parameter @MessageParameter tells me that I have to get an object identified by name "s" from the Message.Boby from my ESB Message. To do that, I created an Action that can accept into one of their properties, which a called "classses", a list of full classes names separated by commas. It is the easiest way to discover the classes without use any other sofisticated engine. See those actions configured into JBoss ESB Eclipse Plugin in the following image: Conclusions Of course something much more sophisticated could be done, but like I did is easy for anybody understand, maybe in the future use some similar strategy that RestEasy does, or even create something in memory using JavaAssist. Another point, I also created annother annotation @Out which would be useful when you change the information inside the parameter that you receive from Message.Body, but after the method you wanna take the changed value to the Message.body context with the changed information... Perharps it sounds like a bijection originally a concept from in JBoss Seam applied for JBoss ESB as well. The actual sources are not the most beautyful, but are working fine, e-mail-me if you need the source code, which basically runs as any other regular quickstart. I hope someday see such feature like that out-of-the-box in JBoss ESB, while it is not true, I am happy with I have done. |
| 阅读全文... |
本站相关内容: |
|
JavaFX vs Plain Old JavaThis week on JavaRanch we've had the honor of having Jim Weaver promoting his JavaFX Book. Jim's a great guy but I'm not sold on JavaFX just yet. While reading up on it and reading responses to questions I get this horrible feeling in my gut reminisce of another slew of (empty) promises from Sun regarding a web technology who's name I won't mention but its initials are JSF. So one of Jim's common responses to "why JavaFX" is "The simple, elegant, declarative scripting that (IMO) makes it as easy to create a JavaFX application without a GUI designer as it is to write a Swing/2D app with a GUI designer."
Plain Old Java Object - Wikipedia, the free encyclopediaPOJO is an acronym for Plain Old Java Object, and is favoured by advocates of the idea that the<sep/> |
互联网相关内容: |
| JavaFX vs Plain Old Java (2008年04月04日) |
| Plain Old Java Object - Wikipedia, the free encyclopedia (2007年11月21日) |
| Instant Messaging for Introverts, or Rude is Plain Old Rude (2008年04月07日) |
| Are Plain Old WebContainers still appropriate in Java EE 5? (2007年08月21日) |








