Thursday, September 4, 2008

POSOS: Plain Old Services Objects in JBoss ESB

Introduction

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:


The following code shows how I configured my jboss-esb.xml, and the configuration of the actions. Look that I can fill in the classes property in how many annottated pojos I want, once they are annotated with our "Esb" annotations:

Once again, the only thing I did on my pojo was add the following annotations, as you can see 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.

15 comments:

Burr Sutter said...

This is a great concept. Please also show the jboss-esb.xml and perhaps the wrapper custom action that performs the "injection" into the POJO. A more complex example would use Smooks earlier in the action chain/pipeline to render POJOs (e.g. Customer, Order) that are injected/outjected into/from this "POSO"

joakim said...

Nice idea with the annotation approach. But, in my mind it would be nicer if the POSOS could be defined directly in the action class attribute, thus the annotation processor would be invoked automatically.

/ Joakim

dghnfgj said...

If I were gold für wow a boy again,world of warcraft gold I would practice perseverance wow gold cheap more often,maple meso and never give up a thing because it was or inconvenient. If we want light,Maple Story Account we must conquer darkness. Perseverance can sometimes equal genius in its results.wow gold kaufen “There are only two creatures,”cheap maplestory mesos syas a proverb, “who can surmount the pyramids—the eagle and the snail.” If I were a boy again,wow geld I would school myself into a habit of attention;maple mesos I would let nothing come between me and the subject in hand.maple story power leveling I would remember that a good skater never tries to skate in two directions at once.billig wow gold The habit of attention becomes part of our life, if we begain early enough. I often hear grown up people say maple story items“ I could not fix my attention on the sermon or book, although I wished to do so” , wow powerlevelingand the reason is, the habit was not formed in youth. If I were to live my life over again,wow leveling I would pay more attention to the cultivation of the memory. I would strengthen that faculty by every possible means,wow power leveling and on every possible occasion.maplestory powerleveling It takes a little hard work at first to remember things accurately;cheap archlord gold but memory soon helps itself, and gives very little trouble. It only needs early cultivation to become a power.

game gold said...

To buy rappelz rupees , it is not the aim of the cable. It is the game which brings a lot of happiness to me. We buy the rappelz gold together. The beautiful story, we can not be forgotten buy rupees . You will not regret to have rappelz money . So I will continue to have cheap rappelz rupees , it is a beautiful fairy tale, it looks like my life.

On account of I have rohan crone , I am not afraid of the lonely. At that time I do not know the meaning of it. Later I buy rohan gold . And every time, I have no rohan online crone , I will feel very anxious. Why I buy rohan online gold , please it gives me such a warm place. At the moment, I have rohan money .

筱娅 said...

Have you heared about 9Dragons which you need use Atlantica online Gold to play, and you can also borrow Atlantica Gold from other players? But you can buy Atlantica online Gold, or you will lose the choice if you do not have cheap Atlantica online Gold. If you get Atlantica online money, you can continue this game.
Have you heared about 9Dragons which you need use Entropiauniverse ped to play, and you can also borrow Entropia Universe Gold from other players? But you can Buy Entropia Universe Gold, or you will lose the choice if you do not have Entropia Universe Money. If you get cheap Entropiauniverse ped, you can continue this game.

dongmei said...

Do you know seal cegel? I like it.
My brother often go to the internet bar to buy sealonline cegel and play it.
After school, He likes playing games using these seal online cegel with his friends.
I do not like to play it. Because I think that it not only costs much money but also spend much time. One day, he give me many cheap seal cegeland play the game with me.
I came to the bar following him and found buy seal online cegelwas so cheap. After that, I also go to play game with him.
It is a very nice game silkroad gold, I like sro gold. You can play it silkroad online gold, you can buy the cheap silk road gold. You smart and buy cheap silkroad gold.

陈凯燕 said...

Do you know cabal online alz? I like it.
My brother often go to the internet bar to buy cabal alz and play it.
After school, He likes playing games using these cabal gold with his friend.
I do not like to play it. Because I think that it not only costs much money but also spend much time. One day, he give me many cabal money and play the game with me.
I came to the bar following him and found buy cabal alz was so cheap. After that, I also go to play game with him.
Do you know eve isk? I like it.
My brother often go to the internet bar to buy eve online isk and play it.
After school, He likes playing games using these buy isk with his friend.
I do not like to play it. Because I think that it not only costs much money but also spend much time. One day, he give me many cheap eve isk and play the game with me.
I came to the bar following him and found buy eve online isk was so cheap. After that, I also go to play game with him.

baobao said...

I always heard something from my neighbor that he sometimes goes to the internet bar to play the game which will use him some LOTRO Gold, he usually can win a lot of Lord Of The Rings Gold, then he let his friends all have some buy LOTRO Gold, his friends thank him very much for introducing them the cheap Lord Of The Rings Gold.
I am so happy to get some ro zeny and the ragnarok zeny is given by my close friend who tells me that the iro zeny is the basis to enter into the game. Therefore, I should cheap zeny with the spare money and I gain some ragnarok online zeny from other players.

cheng said...

Do you want to know the magic of online games, and here you can get more angels gold. Do you want to have a try? Come on and angels online gold can make you happy. You can change a lot buy angels gold for play games. And you can use the cheap angels online gold do what you want to do in the online game.
Do you want to know the magic of online games, and here you can get more Rose zuly. Do you want to have a try? Come on and rose zulie can make you happy.You can change a lot rose online zuly for play games. Playing online games can make much rose online zulie. And you can Arua ROSE zuly do what you want to do in the online game.

feilin said...

I like holic gold very much. Since I entered into this game, I learnt skills to earn holic money. Thanks to holic online gold let me know a lot of friends. It is my habit to buy holic online money, and I get some cheap holic gold from my friends and Internet.
I like to play last chaos, because I like its name, also I like last chaos gold. My friend told me that she would buy lastchaos gold for me, and I was so happy. I do not like to go shopping, because it always spends a lot of money, but I never hesitate to buy last chaos gold. You can buy cheap lastchaos gold; it is so easy and convenient. I believe the future of lastchaos money is bright.

milf said...

find air beds in wisconsinbest air beds in wisconsincloud air beds

best cloud inflatable air bedssealy air beds portableportables air bedsrv luggage racksaluminum made rv luggage racksair bed raisedbest form raised air bedsbed air informercialsbest informercials bed airmattress sized air beds

bestair bed mattress antique doorknobsantique doorknob identification tipsdvd player troubleshootingtroubleshooting with the dvd playerflat panel television lcd vs plasmaflat panel lcd television versus plasma pic the bestadjustable bed air foam The best bed air foam

hoof prints antique equestrian printsantique hoof prints equestrian printsBuy air bedadjustablebuy the best adjustable air bedsair beds canadian storesCanadian stores for air beds

migraine causemigraine treatments floridaflorida headache clinicdrying dessicantair drying dessicant

milf said...

black mold exposureblack mold symptoms of exposurewrought iron garden gatesiron garden gates find them herefine thin hair hairstylessearch hair styles for fine thin hairnight vision binocularsbuy night vision binocularslipitor reactionslipitor allergic reactionsluxury beach resort in the philippines

afordable beach resorts in the philippineshomeopathy for eczema.baby eczema.save big with great mineral makeup bargainsmineral makeup wholesalersprodam iphone Apple prodam iphone prahacect iphone manualmanual for P 168 iphonefero 52 binocularsnight vision Fero 52 binocularsThe best night vision binoculars here

night vision binoculars bargainsfree photo albums computer programsfree software to make photo albumsfree tax formsprintable tax forms for free craftmatic air bedcraftmatic air bed adjustable info hereboyd air bedboyd night air bed lowest price

milf said...

new houston house houston house txstains removal dyestains removal clothesstains removalteeth whiteningteeth whiteningbright teeth

jennifer grey nosejennifer nose jobscalebrities nose jobsWomen with Big NosesWomen hairstylesBig Nose Women, hairstyles

milf said...

dessicant air dryerpediatric asthmaasthma specialistasthma children specialistcarpet cleaning dallas txcarpet cleaners dallascarpet cleaning dallas

vero beach vacationvero beach vacationsbeach vacation homes veroms beach vacationsms beach vacationms beach condosmaui beach vacationmaui beach vacationsmaui beach clubbeach vacationsyour beach vacationscheap beach vacations

bob hairstylebob haircutsbob layeredpob hairstylebobbedclassic bobCare for Curly HairTips for Curly Haircurly hair12r 22.5 best pricetires truck bustires 12r 22.5

washington new housenew house houstonnew house san antonionew house ventura

aravind said...

Hey, this is great.. can i get the src for the code( i guess i need only annotation impls right) you described in POSOS. thanks in adance... aravind.kbase@gmail.com
thanks again