You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@servicemix.apache.org by Philip Dodds <ph...@gmail.com> on 2006/08/18 23:37:53 UTC
Thoughts on a JBI POJO Engine
I have knocked up some thoughts on a JBI POJO engine that could be
used to provide a mechanism for annotating POJO specifically for more
messaging level operations that the JSR181 service engine is aimed
for.
The idea is to provide a simple framework to replace the Spring Client
Toolkit that is now defunt.
Have a look at the idea -
http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
And all comments/thoughts are welcome!!
P
Re: Thoughts on a JBI POJO Engine
Posted by Guillaume Nodet <gn...@gmail.com>.
Note that for orchestration, there is also the bpmscript component
which should do a good job.
On 8/19/06, Philip Dodds <ph...@gmail.com> wrote:
> Thanks for all the feedback - this is great stuff! I've put some
> comments inline below,
>
> P
>
> On 8/18/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > This is a great idea !
> > While the jsr181 component is really helpfull to hide all jbi / xml stuff,
> > the only other solution is to use the lwcontainer or to create a new
> > component from scratch. So i'm all in favor for a new pojo component
> > more related to jbi.
> >
> > A few thoughts ...
> >
> > 1) Annotation drive injection is imho a great tool, but i'm not sure it will
> > give all the features that spring brings like transaction proxies,
> > jndi lookups, etc... Well, i guess it could, but it may be a lot of work.
> > I was thinking about using annotations on the jsr181 component to
> > support EJB via pitchfork.
>
> I agree that some of the inject stuff is great but the spring
> additions can make it more powerful, I'm interested as to whether we
> could look at the SCA inject process and compare it a little with
> pitchfork - though the idea of a spring context around somewhere to
> make stuff available is definiately a good basis for a number of
> things.
>
> >
> > 2) Classpath problem. As the SU will contain java code, you have to be
> > able to create a classloader for this SU. Xbean already does this, but we
> > can find other ways. We could state that the /classes and /lib directories
> > inside a SU would be used to create a classloader. This could also be done
> > for all xbean based components and would avoid the need to write / generate
> > the <classpath /> tag.
>
> I have been thinking so far that the POJO approach wouldn't use XBean
> however I have been wondering if convention over configuration should
> kick in - it if you have an xbean.xml then it will look simply process
> that - therefore you could override POJO's annotations in there and
> also do spring injection etc. However if the XBeanDeployer doesn't
> find an xbean.xml then it creates an Endpoint for each of the
> annotated POJO's it finds in the direct classpath. I have been
> wondering if the same could be applied to the JSR181 - if you don't
> have a xbean.xml then it can look for annotations? Also for a BPEL if
> there isn't an xbean.xml then we look for bpel processes? Its just a
> thought but could simplify the Service Units.
> >
> > 3) Threading model. On the jsr181 component, the threading model is the servlet
> > model: a single thread-safe instance if used to process all requests.
> > However, using
> > spring aop features, you can easily configure pooling or thread based pojos.
> > Should we define a new annotation set for that ?
> > We could also take a look at how SCA defines that: you can define the scope
> > of a bean (per request, session, application, if i recall).
>
> Maybe we should look at cross engine annotations? I'm not sure about
> the SCA threading model but i have been starting to go through the
> tuscany project a little more closely so I'll have a dig around :)
>
>
> >
> > 4) JBI related features. While the jsr181 component can only handle
> > synchronous request / response calls, we should aim to provide a clean
> > support for asynchonous request / response patterns. A consumer should
> > be able to send an InOut exchange asynchronously and a way to provide
> > a callback which would be called when the answer is received.
>
> I wonder if the continuations approach that has been bounced around
> might be useful here? Or the SCA callback approach?
>
> >
> > 5) Support for beanflow. I think this component would be a better candidate
> > than the jsr181 one to provide built-in support for beanflow. This could
> > be very usefull on top of #4 (async messages).
>
> I still need to get my head around beanflow use cases ;)
>
> >
> > 6) Use of the client api (or a simplified version), support for URIs ...
> > James had worked some time ago on a cleaner client api, but
> > setepped back to keep compatibility. The javadocs is still online :(
> > See http://incubator.apache.org/servicemix/maven/servicemix-core/apidocs/org/apache/servicemix/client/Client.html
> > and http://incubator.apache.org/servicemix/maven/servicemix-core/apidocs/org/apache/servicemix/client/Destination.html
> >
> > I think by providing built-in support for beanflow in this component, we could
> > easily implement a pojo based orchestration engine.
> > When an exchange is received by the component, it create a pojo and start
> > the flow. This flow will first receive the exchange, could send an
> > async request / response,
> > each response would call a given method on the pojo, etc ...
>
> I like the idea of a simple POJO orchestration engine and I like the
> idea that URI's might play into that integration!
> >
> > Sorry for this long email ;)
> >
> > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > used to provide a mechanism for annotating POJO specifically for more
> > > messaging level operations that the JSR181 service engine is aimed
> > > for.
> > >
> > > The idea is to provide a simple framework to replace the Spring Client
> > > Toolkit that is now defunt.
> > >
> > > Have a look at the idea -
> > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > >
> > > And all comments/thoughts are welcome!!
> > >
> > > P
> > >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
>
--
Cheers,
Guillaume Nodet
Re: Thoughts on a JBI POJO Engine
Posted by Philip Dodds <ph...@gmail.com>.
Thanks for all the feedback - this is great stuff! I've put some
comments inline below,
P
On 8/18/06, Guillaume Nodet <gn...@gmail.com> wrote:
> This is a great idea !
> While the jsr181 component is really helpfull to hide all jbi / xml stuff,
> the only other solution is to use the lwcontainer or to create a new
> component from scratch. So i'm all in favor for a new pojo component
> more related to jbi.
>
> A few thoughts ...
>
> 1) Annotation drive injection is imho a great tool, but i'm not sure it will
> give all the features that spring brings like transaction proxies,
> jndi lookups, etc... Well, i guess it could, but it may be a lot of work.
> I was thinking about using annotations on the jsr181 component to
> support EJB via pitchfork.
I agree that some of the inject stuff is great but the spring
additions can make it more powerful, I'm interested as to whether we
could look at the SCA inject process and compare it a little with
pitchfork - though the idea of a spring context around somewhere to
make stuff available is definiately a good basis for a number of
things.
>
> 2) Classpath problem. As the SU will contain java code, you have to be
> able to create a classloader for this SU. Xbean already does this, but we
> can find other ways. We could state that the /classes and /lib directories
> inside a SU would be used to create a classloader. This could also be done
> for all xbean based components and would avoid the need to write / generate
> the <classpath /> tag.
I have been thinking so far that the POJO approach wouldn't use XBean
however I have been wondering if convention over configuration should
kick in - it if you have an xbean.xml then it will look simply process
that - therefore you could override POJO's annotations in there and
also do spring injection etc. However if the XBeanDeployer doesn't
find an xbean.xml then it creates an Endpoint for each of the
annotated POJO's it finds in the direct classpath. I have been
wondering if the same could be applied to the JSR181 - if you don't
have a xbean.xml then it can look for annotations? Also for a BPEL if
there isn't an xbean.xml then we look for bpel processes? Its just a
thought but could simplify the Service Units.
>
> 3) Threading model. On the jsr181 component, the threading model is the servlet
> model: a single thread-safe instance if used to process all requests.
> However, using
> spring aop features, you can easily configure pooling or thread based pojos.
> Should we define a new annotation set for that ?
> We could also take a look at how SCA defines that: you can define the scope
> of a bean (per request, session, application, if i recall).
Maybe we should look at cross engine annotations? I'm not sure about
the SCA threading model but i have been starting to go through the
tuscany project a little more closely so I'll have a dig around :)
>
> 4) JBI related features. While the jsr181 component can only handle
> synchronous request / response calls, we should aim to provide a clean
> support for asynchonous request / response patterns. A consumer should
> be able to send an InOut exchange asynchronously and a way to provide
> a callback which would be called when the answer is received.
I wonder if the continuations approach that has been bounced around
might be useful here? Or the SCA callback approach?
>
> 5) Support for beanflow. I think this component would be a better candidate
> than the jsr181 one to provide built-in support for beanflow. This could
> be very usefull on top of #4 (async messages).
I still need to get my head around beanflow use cases ;)
>
> 6) Use of the client api (or a simplified version), support for URIs ...
> James had worked some time ago on a cleaner client api, but
> setepped back to keep compatibility. The javadocs is still online :(
> See http://incubator.apache.org/servicemix/maven/servicemix-core/apidocs/org/apache/servicemix/client/Client.html
> and http://incubator.apache.org/servicemix/maven/servicemix-core/apidocs/org/apache/servicemix/client/Destination.html
>
> I think by providing built-in support for beanflow in this component, we could
> easily implement a pojo based orchestration engine.
> When an exchange is received by the component, it create a pojo and start
> the flow. This flow will first receive the exchange, could send an
> async request / response,
> each response would call a given method on the pojo, etc ...
I like the idea of a simple POJO orchestration engine and I like the
idea that URI's might play into that integration!
>
> Sorry for this long email ;)
>
> On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > I have knocked up some thoughts on a JBI POJO engine that could be
> > used to provide a mechanism for annotating POJO specifically for more
> > messaging level operations that the JSR181 service engine is aimed
> > for.
> >
> > The idea is to provide a simple framework to replace the Spring Client
> > Toolkit that is now defunt.
> >
> > Have a look at the idea -
> > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> >
> > And all comments/thoughts are welcome!!
> >
> > P
> >
>
>
> --
> Cheers,
> Guillaume Nodet
>
Re: Thoughts on a JBI POJO Engine
Posted by Guillaume Nodet <gn...@gmail.com>.
This is a great idea !
While the jsr181 component is really helpfull to hide all jbi / xml stuff,
the only other solution is to use the lwcontainer or to create a new
component from scratch. So i'm all in favor for a new pojo component
more related to jbi.
A few thoughts ...
1) Annotation drive injection is imho a great tool, but i'm not sure it will
give all the features that spring brings like transaction proxies,
jndi lookups, etc... Well, i guess it could, but it may be a lot of work.
I was thinking about using annotations on the jsr181 component to
support EJB via pitchfork.
2) Classpath problem. As the SU will contain java code, you have to be
able to create a classloader for this SU. Xbean already does this, but we
can find other ways. We could state that the /classes and /lib directories
inside a SU would be used to create a classloader. This could also be done
for all xbean based components and would avoid the need to write / generate
the <classpath /> tag.
3) Threading model. On the jsr181 component, the threading model is the servlet
model: a single thread-safe instance if used to process all requests.
However, using
spring aop features, you can easily configure pooling or thread based pojos.
Should we define a new annotation set for that ?
We could also take a look at how SCA defines that: you can define the scope
of a bean (per request, session, application, if i recall).
4) JBI related features. While the jsr181 component can only handle
synchronous request / response calls, we should aim to provide a clean
support for asynchonous request / response patterns. A consumer should
be able to send an InOut exchange asynchronously and a way to provide
a callback which would be called when the answer is received.
5) Support for beanflow. I think this component would be a better candidate
than the jsr181 one to provide built-in support for beanflow. This could
be very usefull on top of #4 (async messages).
6) Use of the client api (or a simplified version), support for URIs ...
James had worked some time ago on a cleaner client api, but
setepped back to keep compatibility. The javadocs is still online :(
See http://incubator.apache.org/servicemix/maven/servicemix-core/apidocs/org/apache/servicemix/client/Client.html
and http://incubator.apache.org/servicemix/maven/servicemix-core/apidocs/org/apache/servicemix/client/Destination.html
I think by providing built-in support for beanflow in this component, we could
easily implement a pojo based orchestration engine.
When an exchange is received by the component, it create a pojo and start
the flow. This flow will first receive the exchange, could send an
async request / response,
each response would call a given method on the pojo, etc ...
Sorry for this long email ;)
On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> I have knocked up some thoughts on a JBI POJO engine that could be
> used to provide a mechanism for annotating POJO specifically for more
> messaging level operations that the JSR181 service engine is aimed
> for.
>
> The idea is to provide a simple framework to replace the Spring Client
> Toolkit that is now defunt.
>
> Have a look at the idea -
> http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
>
> And all comments/thoughts are welcome!!
>
> P
>
--
Cheers,
Guillaume Nodet
Re: Thoughts on a JBI POJO Engine
Posted by James Strachan <ja...@gmail.com>.
On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> I like the logic - also I like the idea that a service could annotate
> two methods and thus end up with the ability to process an InOut and a
> InOnly via two different methods on the same class. The only question
> I suppose it what happens if you want to be able to provide both from
> the same method - say a file reading service that gets the filename in
> an XML path and then reading and passing the file to a providing
> service then can either return an XML representing the number of
> records or not (depending on the MEP?).
Could you show some pseudocode for what you mean? Am not quite sure I follow :)
--
James
-------
http://radio.weblogs.com/0112098/
Re: Thoughts on a JBI POJO Engine
Posted by Philip Dodds <ph...@gmail.com>.
I like the logic - also I like the idea that a service could annotate
two methods and thus end up with the ability to process an InOut and a
InOnly via two different methods on the same class. The only question
I suppose it what happens if you want to be able to provide both from
the same method - say a file reading service that gets the filename in
an XML path and then reading and passing the file to a providing
service then can either return an XML representing the number of
records or not (depending on the MEP?).
Just a thought
P
On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> Brainstorming again - here's some thoughts on some sensible defaults
> we could use for MEPs to keep things as simple as possible...
>
> By default methods which are void are InOnly and methods that are
> non-void are InOut unless there is a typesafe MessageExchange
> parameter or an annotation used to overload things.
>
> e.g. these are InOnly...
>
> @ExchangeProcessor
> void foo(MessageExchange e) {}
>
> @ExchangeProcessor
> void foo(InOnly e) {}
>
> @ExchangeProcessor
> void foo(@MessageContent Document doc) {}
>
>
> // these are InOut
>
> @ExchangeProcessor
> void foo(InOut e) {}
>
> @ExchangeProcessor
> Document foo(@MessageContent Document doc) {}
>
> @ExchangeProcessor(pattern=Pattern.IN_OUT)
> void foo(MessageExchange e) {}
>
> etc
>
>
> I wonder if we should support parameters for the in and out values? e.g.
>
> @ExchangeProcessor
> void foo(@In NormalizedMessage in, @Out NormalizedMessage) {}
>
> or
>
> @ExchangeProcessor
> void foo(@MessageContent Document in, @OutMessageContent Document out) {}
>
>
> On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> > > James,
> > >
> > > I like the idea of sticking to the JSR's where possible - and in fact
> > > I'll run over JSR-250 to see what we can use. Also I agree that the
> > > EJB3/SCA style resource injection might be better - one of the reasons
> > > for the more "verbal" example was just to make it clear a little more
> > > clear what was going on :)
> >
> > Agreed. I think some of the resources injected will need their own
> > annotations. EJB3 does this for a few kinds of resources too. I'd be
> > cool if we could avoid custom annotations where possible though.
> >
> > There seems to be some inconsistency in the use of annotations in this
> > area - some specs insist on new annotations others just use @Resource
> > - i've never quite figured out the reasoning behind the difference :).
> >
> >
> > > As for the exchange processor mapping I think that the second option,
> > > with annotated parameters looks sweet, and would also give us a
> > > little room for doing some neat mapping stuff like -
> > >
> > > @ExchangeProcessor
> > > public void foo(@MessageContentXPath("\customer\name") String name)
> > > {
> > > }
> >
> > Ooh thats neat - I like that! :)
> >
> >
> > > This this would allow "mapping" of a payload to a method, however
> > > when if comes to JAXB2 type mappings and the SomeResponse/SomeRequest
> > > example you put in - I'm not sure that this isn't stepping on the toes
> > > of the SCA/JSR-181 Service Engines?
> >
> > Yeah.
> >
> > I guess ultimately I'd like application developers to not have to
> > mentally think about switching from SCA ot JSR 181 to JBI too much;
> > they should hopefully have similar look and feels. It'd be nice to
> > have a kinda unified set of annotations to use or at least share as
> > many as possible. So hopefully we could reuse JAXB2 across all 3
> > models; SCA, JBI and JSR 181.
> >
> > So for mapping the content of a NormalizedMessage it'd be good to support
> >
> > * Source
> > * DOM / dom4j / XOM et al
> > * SDO
> > * JAXB2/XStream
> > * maybe text?
> >
> > e.g. if using the JBI annotations I don't see why we can't also use
> > the JAXB2 mapping stuff.
> >
> > We might wanna use XPath with JAXB2 as well...
> >
> >
> > > I suppose one of the things here
> > > was providing:
> > >
> > > a) a clean mechanism for writing POJO's that what to interact with the
> > > JBI infrastructure and have been specifically implemented to do so
> > > b) POJO's that what to interact with messaging (not XML-RPC) but more
> > > akin to legacy messaging structures that are being passed around and
> > > allowing you to persist them.
> > >
> > > However, I can see that the JAXB example would be interesting since
> > > you could generate any structure. Also in the second example when you
> > > use the mapping approach - how do you know which MEP's the POJO can
> > > handle?
> >
> > I figured if a result is returned then it'd be an InOut by default
> > unless an annotation is added to explicitly specify the MEP such as
> > InOptionalOut
> >
> > So we could write an InOut processor as
> >
> > @ExchangeProcessor
> > public Document foo(Document in, @MessageParam String foo) {... }
> >
> > --
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
Re: Thoughts on a JBI POJO Engine
Posted by James Strachan <ja...@gmail.com>.
Brainstorming again - here's some thoughts on some sensible defaults
we could use for MEPs to keep things as simple as possible...
By default methods which are void are InOnly and methods that are
non-void are InOut unless there is a typesafe MessageExchange
parameter or an annotation used to overload things.
e.g. these are InOnly...
@ExchangeProcessor
void foo(MessageExchange e) {}
@ExchangeProcessor
void foo(InOnly e) {}
@ExchangeProcessor
void foo(@MessageContent Document doc) {}
// these are InOut
@ExchangeProcessor
void foo(InOut e) {}
@ExchangeProcessor
Document foo(@MessageContent Document doc) {}
@ExchangeProcessor(pattern=Pattern.IN_OUT)
void foo(MessageExchange e) {}
etc
I wonder if we should support parameters for the in and out values? e.g.
@ExchangeProcessor
void foo(@In NormalizedMessage in, @Out NormalizedMessage) {}
or
@ExchangeProcessor
void foo(@MessageContent Document in, @OutMessageContent Document out) {}
On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> > James,
> >
> > I like the idea of sticking to the JSR's where possible - and in fact
> > I'll run over JSR-250 to see what we can use. Also I agree that the
> > EJB3/SCA style resource injection might be better - one of the reasons
> > for the more "verbal" example was just to make it clear a little more
> > clear what was going on :)
>
> Agreed. I think some of the resources injected will need their own
> annotations. EJB3 does this for a few kinds of resources too. I'd be
> cool if we could avoid custom annotations where possible though.
>
> There seems to be some inconsistency in the use of annotations in this
> area - some specs insist on new annotations others just use @Resource
> - i've never quite figured out the reasoning behind the difference :).
>
>
> > As for the exchange processor mapping I think that the second option,
> > with annotated parameters looks sweet, and would also give us a
> > little room for doing some neat mapping stuff like -
> >
> > @ExchangeProcessor
> > public void foo(@MessageContentXPath("\customer\name") String name)
> > {
> > }
>
> Ooh thats neat - I like that! :)
>
>
> > This this would allow "mapping" of a payload to a method, however
> > when if comes to JAXB2 type mappings and the SomeResponse/SomeRequest
> > example you put in - I'm not sure that this isn't stepping on the toes
> > of the SCA/JSR-181 Service Engines?
>
> Yeah.
>
> I guess ultimately I'd like application developers to not have to
> mentally think about switching from SCA ot JSR 181 to JBI too much;
> they should hopefully have similar look and feels. It'd be nice to
> have a kinda unified set of annotations to use or at least share as
> many as possible. So hopefully we could reuse JAXB2 across all 3
> models; SCA, JBI and JSR 181.
>
> So for mapping the content of a NormalizedMessage it'd be good to support
>
> * Source
> * DOM / dom4j / XOM et al
> * SDO
> * JAXB2/XStream
> * maybe text?
>
> e.g. if using the JBI annotations I don't see why we can't also use
> the JAXB2 mapping stuff.
>
> We might wanna use XPath with JAXB2 as well...
>
>
> > I suppose one of the things here
> > was providing:
> >
> > a) a clean mechanism for writing POJO's that what to interact with the
> > JBI infrastructure and have been specifically implemented to do so
> > b) POJO's that what to interact with messaging (not XML-RPC) but more
> > akin to legacy messaging structures that are being passed around and
> > allowing you to persist them.
> >
> > However, I can see that the JAXB example would be interesting since
> > you could generate any structure. Also in the second example when you
> > use the mapping approach - how do you know which MEP's the POJO can
> > handle?
>
> I figured if a result is returned then it'd be an InOut by default
> unless an annotation is added to explicitly specify the MEP such as
> InOptionalOut
>
> So we could write an InOut processor as
>
> @ExchangeProcessor
> public Document foo(Document in, @MessageParam String foo) {... }
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: Thoughts on a JBI POJO Engine
Posted by James Strachan <ja...@gmail.com>.
On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> James,
>
> I like the idea of sticking to the JSR's where possible - and in fact
> I'll run over JSR-250 to see what we can use. Also I agree that the
> EJB3/SCA style resource injection might be better - one of the reasons
> for the more "verbal" example was just to make it clear a little more
> clear what was going on :)
Agreed. I think some of the resources injected will need their own
annotations. EJB3 does this for a few kinds of resources too. I'd be
cool if we could avoid custom annotations where possible though.
There seems to be some inconsistency in the use of annotations in this
area - some specs insist on new annotations others just use @Resource
- i've never quite figured out the reasoning behind the difference :).
> As for the exchange processor mapping I think that the second option,
> with annotated parameters looks sweet, and would also give us a
> little room for doing some neat mapping stuff like -
>
> @ExchangeProcessor
> public void foo(@MessageContentXPath("\customer\name") String name)
> {
> }
Ooh thats neat - I like that! :)
> This this would allow "mapping" of a payload to a method, however
> when if comes to JAXB2 type mappings and the SomeResponse/SomeRequest
> example you put in - I'm not sure that this isn't stepping on the toes
> of the SCA/JSR-181 Service Engines?
Yeah.
I guess ultimately I'd like application developers to not have to
mentally think about switching from SCA ot JSR 181 to JBI too much;
they should hopefully have similar look and feels. It'd be nice to
have a kinda unified set of annotations to use or at least share as
many as possible. So hopefully we could reuse JAXB2 across all 3
models; SCA, JBI and JSR 181.
So for mapping the content of a NormalizedMessage it'd be good to support
* Source
* DOM / dom4j / XOM et al
* SDO
* JAXB2/XStream
* maybe text?
e.g. if using the JBI annotations I don't see why we can't also use
the JAXB2 mapping stuff.
We might wanna use XPath with JAXB2 as well...
> I suppose one of the things here
> was providing:
>
> a) a clean mechanism for writing POJO's that what to interact with the
> JBI infrastructure and have been specifically implemented to do so
> b) POJO's that what to interact with messaging (not XML-RPC) but more
> akin to legacy messaging structures that are being passed around and
> allowing you to persist them.
>
> However, I can see that the JAXB example would be interesting since
> you could generate any structure. Also in the second example when you
> use the mapping approach - how do you know which MEP's the POJO can
> handle?
I figured if a result is returned then it'd be an InOut by default
unless an annotation is added to explicitly specify the MEP such as
InOptionalOut
So we could write an InOut processor as
@ExchangeProcessor
public Document foo(Document in, @MessageParam String foo) {... }
--
James
-------
http://radio.weblogs.com/0112098/
Re: Thoughts on a JBI POJO Engine
Posted by Philip Dodds <ph...@gmail.com>.
James,
I like the idea of sticking to the JSR's where possible - and in fact
I'll run over JSR-250 to see what we can use. Also I agree that the
EJB3/SCA style resource injection might be better - one of the reasons
for the more "verbal" example was just to make it clear a little more
clear what was going on :)
As for the exchange processor mapping I think that the second option,
with annotated parameters looks sweet, and would also give us a
little room for doing some neat mapping stuff like -
@ExchangeProcessor
public void foo(@MessageContentXPath("\customer\name") String name)
{
}
This this would allow "mapping" of a payload to a method, however
when if comes to JAXB2 type mappings and the SomeResponse/SomeRequest
example you put in - I'm not sure that this isn't stepping on the toes
of the SCA/JSR-181 Service Engines? I suppose one of the things here
was providing:
a) a clean mechanism for writing POJO's that what to interact with the
JBI infrastructure and have been specifically implemented to do so
b) POJO's that what to interact with messaging (not XML-RPC) but more
akin to legacy messaging structures that are being passed around and
allowing you to persist them.
However, I can see that the JAXB example would be interesting since
you could generate any structure. Also in the second example when you
use the mapping approach - how do you know which MEP's the POJO can
handle?
P
On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> Just a bit of brainstorming of ideas here.
>
> I was looking at this example
>
> @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> public void myInOutProcessor(MessageExchange me) {
> // Do something here
> }
>
> @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> ParameterMapping.IN_MESSAGE_CONTENT })
> public void myInOnlyProcessor(Source payload) {
> // Do something here
> }
>
> and wondering how to simplify a little.
>
> My first thought was to use an annotation for each kind of exchange to
> be supported...
>
> @InOnlyExchange @RobustInOnlyExchange
> public void foo(MessageExchange exchange) {
> }
>
> (I realised we'd get class name clashes so added the 'Exchange'
> postfix to the annotation names. Then I figured it might be simpler to
> just use a typesafe API...
>
> @ExchangeProcessor
> public void foo(InOnly exchange) {
> }
>
> @ExchangeProcessor
> public void bar(RobustInOnly exchange) {
> }
>
> I guess sometimes folks might not want to see/use the exchange or
> might wish to support multiple patterns for one method so some kinda
> annotation to indicate the exchange pattern is still useful.
>
>
> Also how about annotating parameters as being bound to the exchange...
>
> @ExchangeProcessor
> public void foo(@MessageProperty('cheese') String foo,
> @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> {
> }
>
> While the @MessageContent may at first not appear that useful, we
> could allow some automatic tranformations from common types to message
> contents such as DOM or JAXB marshalling etc
>
> e.g.
>
> @ExchangeProcessor
> public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
>
> where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
>
> This would allow folks to process exchanges without using any of the
> JBI APIs if they wish - or inject a MessageExchange or
> NormalizedMessage into a parameter if required.
>
>
> On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > Great stuff Philip!
> >
> > More feedback as I start digesting this fully and reading this whole
> > thread but my first reaction is could we try to stick to standard
> > annotations where possible - such as those defined in JSR 250? e.g.
> >
> > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> >
> > so
> >
> > @ServiceStartup -> @PostConstruct
> >
> > @ServiceShutdown -> @PreDestroy
> >
> > am also wondering how many of the other annotations are really
> > required on injected fields - could we just use @Resource to indicate
> > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > sure some of the annotations are required though; am just wondering
> > how many of them are
> >
> >
> > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > used to provide a mechanism for annotating POJO specifically for more
> > > messaging level operations that the JSR181 service engine is aimed
> > > for.
> > >
> > > The idea is to provide a simple framework to replace the Spring Client
> > > Toolkit that is now defunt.
> > >
> > > Have a look at the idea -
> > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > >
> > > And all comments/thoughts are welcome!!
> > >
> > > P
> > >
> >
> >
> > --
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
Re: Thoughts on a JBI POJO Engine
Posted by James Strachan <ja...@gmail.com>.
On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> While I fully agree to simplify the annotations used,
> if you begin to map parameters to properties or xml content,
> you end up to jsr181 component.
Yeah :) I guess thinking of how to enrich ServiceMix's JSR 181
component to fully support all the JBI related APIs and features is
probably the best approach to avoid having too many ways of doing
things and reusing code etc.
> I have already planned to add annotations a la jaxws to allow
> properties to be mapped to parameters in jsr181. A kind of
> JBI annotations set for jaxws (compared to the existing SOAP annotations).
Yeah. I think thats the main difference really - allowing the exposing
of JBI related objects and properties rather than SOAP headers/body.
> But if we begin to handle xml mapping here, we would end
> with 2 components with little differences.
Yeah - unifying in a single component sounds like it'd make sense
> For example, the
> @ExchangeProcessor
> public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
>
> could be further simplified to
>
> @WebMethod
> public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
>
> which is exactly what the jsr181 component do ;)
:)
> Note that the jsr181 component should already by able to
> handle Source types as a parameter (which would map to
> the full payload), and we should be able to add a MessageExchange
> parameter which would receive the exchange without disturbing
> other parameters (xfire already does that for xfire specific
> classes, such as the context).
Sounds cool with me :)
> We need to clearly agree on what we want to show and hide from
> the jbi spec in this component. I don't think we need another SE
> that do xml marshalling (we'd better enhance the existing one).
>
> The main things to define imho are:
> * how to return the answer if using an InOut
> * when the pojo acts as a consumer, how will it receive the answer
> from an InOut exchange it has previsouly sent
Maybe using Future<SomeResponse> objects?
> I really think there is something to do with beanflow.
Yeah
> I will try to think about that a bit more.
Agreed - me too. Am really enjoying this thread BTW - I need to sleep
on this a bit more :)
--
James
-------
http://radio.weblogs.com/0112098/
Re: Thoughts on a JBI POJO Engine
Posted by Guillaume Nodet <gn...@gmail.com>.
Yes, I think so.
But maybe we could have some common code / annotations which could be reused.
Especially if we try to put pitchfork (EJB3) in jsr181, which would
introduce some
annotations driven injection.
On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> So just so I get it - are we still thinking of two engines? The
> reason I ask is I'm not sure about an uber-engine that does everything
> - simply because it sort of breaks that whole SE flexbiity and also
> makes understanding it all a little more tricky.
>
> I'm going to try and update the page today with some of the discussion
> here so we can track where we are going :)
>
> P
>
> On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > I do think we agree ;)
> >
> > The only thing i meant, was that this new component should focus on:
> > * messaging style (asynchronous)
> > * xml payload
> > * closer to jbi
> > whereas jsr181 is good for web service stuff (completely hiding jbi,
> > doing xml/java marshalling, rpc, etc..).
> > Stating that provides imho a clear difference between the two components.
> >
> > On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> > > Guillaume,
> > >
> > > I agree that we need to define the difference between components more
> > > clearly - I suppose in my mind the JBI component under discussion here
> > > is basically a mechanism when you are focussing on XML messaging in a
> > > format that can not be changed or where you want to interact with the
> > > JBI message bus to provide either InOnly reciept of messages or to
> > > build a consumer that will run through a provided WorkManager.
> > >
> > > The JSR181 components to be have always had explicit business
> > > interfaces and work more akin to Web Services or EJB's then MDB's
> > > (sorry for the switching back to the old days). I was hoping that
> > > people building "integration" service units would simply want to be
> > > playing with payloads or mapping in some specific bits of information
> > > from an XML document (people who would be familiar familiar with XPath
> > > and DOM say) and would want to act on that information and reply with
> > > a Document or create an exchange to another service. While I suppose
> > > IMHO the JSR181 is more for people wishing to expose Business Services
> > > to the bus, and would be used by people designing application
> > > endpoints - which would be defining the payload of the messages not
> > > simply being given the payload?
> > >
> > > The different would be in the purposing and flexibilty of the POJO's -
> > > the JBI would be quick (and maybe a little dirty) which it could work
> > > on any payload of message etc and could interact with a InOut
> > > exchange, get the property from the exchange, update the Fault and
> > > Error etc. While the JSR181 would be a way to expose business
> > > services to the bus (whereby your focus is on WSDL, and structured
> > > data).
> > >
> > > I realize you can do any payload in JSR181 but I'm wondering whether
> > > that is simply pushing the JSR181 container into doing more than it is
> > > best suited?
> > >
> > > P
> > >
> > > On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > > While I fully agree to simplify the annotations used,
> > > > if you begin to map parameters to properties or xml content,
> > > > you end up to jsr181 component.
> > > >
> > > > I have already planned to add annotations a la jaxws to allow
> > > > properties to be mapped to parameters in jsr181. A kind of
> > > > JBI annotations set for jaxws (compared to the existing SOAP annotations).
> > > > But if we begin to handle xml mapping here, we would end
> > > > with 2 components with little differences.
> > > >
> > > > For example, the
> > > > @ExchangeProcessor
> > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > >
> > > > could be further simplified to
> > > >
> > > > @WebMethod
> > > > public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
> > > >
> > > > which is exactly what the jsr181 component do ;)
> > > >
> > > > Note that the jsr181 component should already by able to
> > > > handle Source types as a parameter (which would map to
> > > > the full payload), and we should be able to add a MessageExchange
> > > > parameter which would receive the exchange without disturbing
> > > > other parameters (xfire already does that for xfire specific
> > > > classes, such as the context).
> > > >
> > > > We need to clearly agree on what we want to show and hide from
> > > > the jbi spec in this component. I don't think we need another SE
> > > > that do xml marshalling (we'd better enhance the existing one).
> > > >
> > > > The main things to define imho are:
> > > > * how to return the answer if using an InOut
> > > > * when the pojo acts as a consumer, how will it receive the answer
> > > > from an InOut exchange it has previsouly sent
> > > >
> > > > I really think there is something to do with beanflow.
> > > > I will try to think about that a bit more.
> > > >
> > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > Just a bit of brainstorming of ideas here.
> > > > >
> > > > > I was looking at this example
> > > > >
> > > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > > > > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > > > > public void myInOutProcessor(MessageExchange me) {
> > > > > // Do something here
> > > > > }
> > > > >
> > > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > > > > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > > > > ParameterMapping.IN_MESSAGE_CONTENT })
> > > > > public void myInOnlyProcessor(Source payload) {
> > > > > // Do something here
> > > > > }
> > > > >
> > > > > and wondering how to simplify a little.
> > > > >
> > > > > My first thought was to use an annotation for each kind of exchange to
> > > > > be supported...
> > > > >
> > > > > @InOnlyExchange @RobustInOnlyExchange
> > > > > public void foo(MessageExchange exchange) {
> > > > > }
> > > > >
> > > > > (I realised we'd get class name clashes so added the 'Exchange'
> > > > > postfix to the annotation names. Then I figured it might be simpler to
> > > > > just use a typesafe API...
> > > > >
> > > > > @ExchangeProcessor
> > > > > public void foo(InOnly exchange) {
> > > > > }
> > > > >
> > > > > @ExchangeProcessor
> > > > > public void bar(RobustInOnly exchange) {
> > > > > }
> > > > >
> > > > > I guess sometimes folks might not want to see/use the exchange or
> > > > > might wish to support multiple patterns for one method so some kinda
> > > > > annotation to indicate the exchange pattern is still useful.
> > > > >
> > > > >
> > > > > Also how about annotating parameters as being bound to the exchange...
> > > > >
> > > > > @ExchangeProcessor
> > > > > public void foo(@MessageProperty('cheese') String foo,
> > > > > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > > > > {
> > > > > }
> > > > >
> > > > > While the @MessageContent may at first not appear that useful, we
> > > > > could allow some automatic tranformations from common types to message
> > > > > contents such as DOM or JAXB marshalling etc
> > > > >
> > > > > e.g.
> > > > >
> > > > > @ExchangeProcessor
> > > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > > >
> > > > > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> > > > >
> > > > > This would allow folks to process exchanges without using any of the
> > > > > JBI APIs if they wish - or inject a MessageExchange or
> > > > > NormalizedMessage into a parameter if required.
> > > > >
> > > > >
> > > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > > Great stuff Philip!
> > > > > >
> > > > > > More feedback as I start digesting this fully and reading this whole
> > > > > > thread but my first reaction is could we try to stick to standard
> > > > > > annotations where possible - such as those defined in JSR 250? e.g.
> > > > > >
> > > > > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > > > > >
> > > > > > so
> > > > > >
> > > > > > @ServiceStartup -> @PostConstruct
> > > > > >
> > > > > > @ServiceShutdown -> @PreDestroy
> > > > > >
> > > > > > am also wondering how many of the other annotations are really
> > > > > > required on injected fields - could we just use @Resource to indicate
> > > > > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > > > > sure some of the annotations are required though; am just wondering
> > > > > > how many of them are
> > > > > >
> > > > > >
> > > > > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > > > > used to provide a mechanism for annotating POJO specifically for more
> > > > > > > messaging level operations that the JSR181 service engine is aimed
> > > > > > > for.
> > > > > > >
> > > > > > > The idea is to provide a simple framework to replace the Spring Client
> > > > > > > Toolkit that is now defunt.
> > > > > > >
> > > > > > > Have a look at the idea -
> > > > > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > > > > >
> > > > > > > And all comments/thoughts are welcome!!
> > > > > > >
> > > > > > > P
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > James
> > > > > > -------
> > > > > > http://radio.weblogs.com/0112098/
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > James
> > > > > -------
> > > > > http://radio.weblogs.com/0112098/
> > > > >
> > > >
> > > >
> > > > --
> > > > Cheers,
> > > > Guillaume Nodet
> > > >
> > >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
>
--
Cheers,
Guillaume Nodet
Re: Thoughts on a JBI POJO Engine
Posted by Philip Dodds <ph...@gmail.com>.
So just so I get it - are we still thinking of two engines? The
reason I ask is I'm not sure about an uber-engine that does everything
- simply because it sort of breaks that whole SE flexbiity and also
makes understanding it all a little more tricky.
I'm going to try and update the page today with some of the discussion
here so we can track where we are going :)
P
On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> I do think we agree ;)
>
> The only thing i meant, was that this new component should focus on:
> * messaging style (asynchronous)
> * xml payload
> * closer to jbi
> whereas jsr181 is good for web service stuff (completely hiding jbi,
> doing xml/java marshalling, rpc, etc..).
> Stating that provides imho a clear difference between the two components.
>
> On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> > Guillaume,
> >
> > I agree that we need to define the difference between components more
> > clearly - I suppose in my mind the JBI component under discussion here
> > is basically a mechanism when you are focussing on XML messaging in a
> > format that can not be changed or where you want to interact with the
> > JBI message bus to provide either InOnly reciept of messages or to
> > build a consumer that will run through a provided WorkManager.
> >
> > The JSR181 components to be have always had explicit business
> > interfaces and work more akin to Web Services or EJB's then MDB's
> > (sorry for the switching back to the old days). I was hoping that
> > people building "integration" service units would simply want to be
> > playing with payloads or mapping in some specific bits of information
> > from an XML document (people who would be familiar familiar with XPath
> > and DOM say) and would want to act on that information and reply with
> > a Document or create an exchange to another service. While I suppose
> > IMHO the JSR181 is more for people wishing to expose Business Services
> > to the bus, and would be used by people designing application
> > endpoints - which would be defining the payload of the messages not
> > simply being given the payload?
> >
> > The different would be in the purposing and flexibilty of the POJO's -
> > the JBI would be quick (and maybe a little dirty) which it could work
> > on any payload of message etc and could interact with a InOut
> > exchange, get the property from the exchange, update the Fault and
> > Error etc. While the JSR181 would be a way to expose business
> > services to the bus (whereby your focus is on WSDL, and structured
> > data).
> >
> > I realize you can do any payload in JSR181 but I'm wondering whether
> > that is simply pushing the JSR181 container into doing more than it is
> > best suited?
> >
> > P
> >
> > On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > While I fully agree to simplify the annotations used,
> > > if you begin to map parameters to properties or xml content,
> > > you end up to jsr181 component.
> > >
> > > I have already planned to add annotations a la jaxws to allow
> > > properties to be mapped to parameters in jsr181. A kind of
> > > JBI annotations set for jaxws (compared to the existing SOAP annotations).
> > > But if we begin to handle xml mapping here, we would end
> > > with 2 components with little differences.
> > >
> > > For example, the
> > > @ExchangeProcessor
> > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > >
> > > could be further simplified to
> > >
> > > @WebMethod
> > > public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
> > >
> > > which is exactly what the jsr181 component do ;)
> > >
> > > Note that the jsr181 component should already by able to
> > > handle Source types as a parameter (which would map to
> > > the full payload), and we should be able to add a MessageExchange
> > > parameter which would receive the exchange without disturbing
> > > other parameters (xfire already does that for xfire specific
> > > classes, such as the context).
> > >
> > > We need to clearly agree on what we want to show and hide from
> > > the jbi spec in this component. I don't think we need another SE
> > > that do xml marshalling (we'd better enhance the existing one).
> > >
> > > The main things to define imho are:
> > > * how to return the answer if using an InOut
> > > * when the pojo acts as a consumer, how will it receive the answer
> > > from an InOut exchange it has previsouly sent
> > >
> > > I really think there is something to do with beanflow.
> > > I will try to think about that a bit more.
> > >
> > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > Just a bit of brainstorming of ideas here.
> > > >
> > > > I was looking at this example
> > > >
> > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > > > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > > > public void myInOutProcessor(MessageExchange me) {
> > > > // Do something here
> > > > }
> > > >
> > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > > > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > > > ParameterMapping.IN_MESSAGE_CONTENT })
> > > > public void myInOnlyProcessor(Source payload) {
> > > > // Do something here
> > > > }
> > > >
> > > > and wondering how to simplify a little.
> > > >
> > > > My first thought was to use an annotation for each kind of exchange to
> > > > be supported...
> > > >
> > > > @InOnlyExchange @RobustInOnlyExchange
> > > > public void foo(MessageExchange exchange) {
> > > > }
> > > >
> > > > (I realised we'd get class name clashes so added the 'Exchange'
> > > > postfix to the annotation names. Then I figured it might be simpler to
> > > > just use a typesafe API...
> > > >
> > > > @ExchangeProcessor
> > > > public void foo(InOnly exchange) {
> > > > }
> > > >
> > > > @ExchangeProcessor
> > > > public void bar(RobustInOnly exchange) {
> > > > }
> > > >
> > > > I guess sometimes folks might not want to see/use the exchange or
> > > > might wish to support multiple patterns for one method so some kinda
> > > > annotation to indicate the exchange pattern is still useful.
> > > >
> > > >
> > > > Also how about annotating parameters as being bound to the exchange...
> > > >
> > > > @ExchangeProcessor
> > > > public void foo(@MessageProperty('cheese') String foo,
> > > > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > > > {
> > > > }
> > > >
> > > > While the @MessageContent may at first not appear that useful, we
> > > > could allow some automatic tranformations from common types to message
> > > > contents such as DOM or JAXB marshalling etc
> > > >
> > > > e.g.
> > > >
> > > > @ExchangeProcessor
> > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > >
> > > > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> > > >
> > > > This would allow folks to process exchanges without using any of the
> > > > JBI APIs if they wish - or inject a MessageExchange or
> > > > NormalizedMessage into a parameter if required.
> > > >
> > > >
> > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > Great stuff Philip!
> > > > >
> > > > > More feedback as I start digesting this fully and reading this whole
> > > > > thread but my first reaction is could we try to stick to standard
> > > > > annotations where possible - such as those defined in JSR 250? e.g.
> > > > >
> > > > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > > > >
> > > > > so
> > > > >
> > > > > @ServiceStartup -> @PostConstruct
> > > > >
> > > > > @ServiceShutdown -> @PreDestroy
> > > > >
> > > > > am also wondering how many of the other annotations are really
> > > > > required on injected fields - could we just use @Resource to indicate
> > > > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > > > sure some of the annotations are required though; am just wondering
> > > > > how many of them are
> > > > >
> > > > >
> > > > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > > > used to provide a mechanism for annotating POJO specifically for more
> > > > > > messaging level operations that the JSR181 service engine is aimed
> > > > > > for.
> > > > > >
> > > > > > The idea is to provide a simple framework to replace the Spring Client
> > > > > > Toolkit that is now defunt.
> > > > > >
> > > > > > Have a look at the idea -
> > > > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > > > >
> > > > > > And all comments/thoughts are welcome!!
> > > > > >
> > > > > > P
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > James
> > > > > -------
> > > > > http://radio.weblogs.com/0112098/
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > James
> > > > -------
> > > > http://radio.weblogs.com/0112098/
> > > >
> > >
> > >
> > > --
> > > Cheers,
> > > Guillaume Nodet
> > >
> >
>
>
> --
> Cheers,
> Guillaume Nodet
>
Re: Thoughts on a JBI POJO Engine
Posted by Guillaume Nodet <gn...@gmail.com>.
I do think we agree ;)
The only thing i meant, was that this new component should focus on:
* messaging style (asynchronous)
* xml payload
* closer to jbi
whereas jsr181 is good for web service stuff (completely hiding jbi,
doing xml/java marshalling, rpc, etc..).
Stating that provides imho a clear difference between the two components.
On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> Guillaume,
>
> I agree that we need to define the difference between components more
> clearly - I suppose in my mind the JBI component under discussion here
> is basically a mechanism when you are focussing on XML messaging in a
> format that can not be changed or where you want to interact with the
> JBI message bus to provide either InOnly reciept of messages or to
> build a consumer that will run through a provided WorkManager.
>
> The JSR181 components to be have always had explicit business
> interfaces and work more akin to Web Services or EJB's then MDB's
> (sorry for the switching back to the old days). I was hoping that
> people building "integration" service units would simply want to be
> playing with payloads or mapping in some specific bits of information
> from an XML document (people who would be familiar familiar with XPath
> and DOM say) and would want to act on that information and reply with
> a Document or create an exchange to another service. While I suppose
> IMHO the JSR181 is more for people wishing to expose Business Services
> to the bus, and would be used by people designing application
> endpoints - which would be defining the payload of the messages not
> simply being given the payload?
>
> The different would be in the purposing and flexibilty of the POJO's -
> the JBI would be quick (and maybe a little dirty) which it could work
> on any payload of message etc and could interact with a InOut
> exchange, get the property from the exchange, update the Fault and
> Error etc. While the JSR181 would be a way to expose business
> services to the bus (whereby your focus is on WSDL, and structured
> data).
>
> I realize you can do any payload in JSR181 but I'm wondering whether
> that is simply pushing the JSR181 container into doing more than it is
> best suited?
>
> P
>
> On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > While I fully agree to simplify the annotations used,
> > if you begin to map parameters to properties or xml content,
> > you end up to jsr181 component.
> >
> > I have already planned to add annotations a la jaxws to allow
> > properties to be mapped to parameters in jsr181. A kind of
> > JBI annotations set for jaxws (compared to the existing SOAP annotations).
> > But if we begin to handle xml mapping here, we would end
> > with 2 components with little differences.
> >
> > For example, the
> > @ExchangeProcessor
> > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> >
> > could be further simplified to
> >
> > @WebMethod
> > public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
> >
> > which is exactly what the jsr181 component do ;)
> >
> > Note that the jsr181 component should already by able to
> > handle Source types as a parameter (which would map to
> > the full payload), and we should be able to add a MessageExchange
> > parameter which would receive the exchange without disturbing
> > other parameters (xfire already does that for xfire specific
> > classes, such as the context).
> >
> > We need to clearly agree on what we want to show and hide from
> > the jbi spec in this component. I don't think we need another SE
> > that do xml marshalling (we'd better enhance the existing one).
> >
> > The main things to define imho are:
> > * how to return the answer if using an InOut
> > * when the pojo acts as a consumer, how will it receive the answer
> > from an InOut exchange it has previsouly sent
> >
> > I really think there is something to do with beanflow.
> > I will try to think about that a bit more.
> >
> > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > Just a bit of brainstorming of ideas here.
> > >
> > > I was looking at this example
> > >
> > > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > > public void myInOutProcessor(MessageExchange me) {
> > > // Do something here
> > > }
> > >
> > > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > > ParameterMapping.IN_MESSAGE_CONTENT })
> > > public void myInOnlyProcessor(Source payload) {
> > > // Do something here
> > > }
> > >
> > > and wondering how to simplify a little.
> > >
> > > My first thought was to use an annotation for each kind of exchange to
> > > be supported...
> > >
> > > @InOnlyExchange @RobustInOnlyExchange
> > > public void foo(MessageExchange exchange) {
> > > }
> > >
> > > (I realised we'd get class name clashes so added the 'Exchange'
> > > postfix to the annotation names. Then I figured it might be simpler to
> > > just use a typesafe API...
> > >
> > > @ExchangeProcessor
> > > public void foo(InOnly exchange) {
> > > }
> > >
> > > @ExchangeProcessor
> > > public void bar(RobustInOnly exchange) {
> > > }
> > >
> > > I guess sometimes folks might not want to see/use the exchange or
> > > might wish to support multiple patterns for one method so some kinda
> > > annotation to indicate the exchange pattern is still useful.
> > >
> > >
> > > Also how about annotating parameters as being bound to the exchange...
> > >
> > > @ExchangeProcessor
> > > public void foo(@MessageProperty('cheese') String foo,
> > > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > > {
> > > }
> > >
> > > While the @MessageContent may at first not appear that useful, we
> > > could allow some automatic tranformations from common types to message
> > > contents such as DOM or JAXB marshalling etc
> > >
> > > e.g.
> > >
> > > @ExchangeProcessor
> > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > >
> > > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> > >
> > > This would allow folks to process exchanges without using any of the
> > > JBI APIs if they wish - or inject a MessageExchange or
> > > NormalizedMessage into a parameter if required.
> > >
> > >
> > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > Great stuff Philip!
> > > >
> > > > More feedback as I start digesting this fully and reading this whole
> > > > thread but my first reaction is could we try to stick to standard
> > > > annotations where possible - such as those defined in JSR 250? e.g.
> > > >
> > > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > > >
> > > > so
> > > >
> > > > @ServiceStartup -> @PostConstruct
> > > >
> > > > @ServiceShutdown -> @PreDestroy
> > > >
> > > > am also wondering how many of the other annotations are really
> > > > required on injected fields - could we just use @Resource to indicate
> > > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > > sure some of the annotations are required though; am just wondering
> > > > how many of them are
> > > >
> > > >
> > > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > > used to provide a mechanism for annotating POJO specifically for more
> > > > > messaging level operations that the JSR181 service engine is aimed
> > > > > for.
> > > > >
> > > > > The idea is to provide a simple framework to replace the Spring Client
> > > > > Toolkit that is now defunt.
> > > > >
> > > > > Have a look at the idea -
> > > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > > >
> > > > > And all comments/thoughts are welcome!!
> > > > >
> > > > > P
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > James
> > > > -------
> > > > http://radio.weblogs.com/0112098/
> > > >
> > >
> > >
> > > --
> > >
> > > James
> > > -------
> > > http://radio.weblogs.com/0112098/
> > >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
>
--
Cheers,
Guillaume Nodet
Re: Thoughts on a JBI POJO Engine
Posted by Philip Dodds <ph...@gmail.com>.
Guillaume,
I agree that we need to define the difference between components more
clearly - I suppose in my mind the JBI component under discussion here
is basically a mechanism when you are focussing on XML messaging in a
format that can not be changed or where you want to interact with the
JBI message bus to provide either InOnly reciept of messages or to
build a consumer that will run through a provided WorkManager.
The JSR181 components to be have always had explicit business
interfaces and work more akin to Web Services or EJB's then MDB's
(sorry for the switching back to the old days). I was hoping that
people building "integration" service units would simply want to be
playing with payloads or mapping in some specific bits of information
from an XML document (people who would be familiar familiar with XPath
and DOM say) and would want to act on that information and reply with
a Document or create an exchange to another service. While I suppose
IMHO the JSR181 is more for people wishing to expose Business Services
to the bus, and would be used by people designing application
endpoints - which would be defining the payload of the messages not
simply being given the payload?
The different would be in the purposing and flexibilty of the POJO's -
the JBI would be quick (and maybe a little dirty) which it could work
on any payload of message etc and could interact with a InOut
exchange, get the property from the exchange, update the Fault and
Error etc. While the JSR181 would be a way to expose business
services to the bus (whereby your focus is on WSDL, and structured
data).
I realize you can do any payload in JSR181 but I'm wondering whether
that is simply pushing the JSR181 container into doing more than it is
best suited?
P
On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> While I fully agree to simplify the annotations used,
> if you begin to map parameters to properties or xml content,
> you end up to jsr181 component.
>
> I have already planned to add annotations a la jaxws to allow
> properties to be mapped to parameters in jsr181. A kind of
> JBI annotations set for jaxws (compared to the existing SOAP annotations).
> But if we begin to handle xml mapping here, we would end
> with 2 components with little differences.
>
> For example, the
> @ExchangeProcessor
> public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
>
> could be further simplified to
>
> @WebMethod
> public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
>
> which is exactly what the jsr181 component do ;)
>
> Note that the jsr181 component should already by able to
> handle Source types as a parameter (which would map to
> the full payload), and we should be able to add a MessageExchange
> parameter which would receive the exchange without disturbing
> other parameters (xfire already does that for xfire specific
> classes, such as the context).
>
> We need to clearly agree on what we want to show and hide from
> the jbi spec in this component. I don't think we need another SE
> that do xml marshalling (we'd better enhance the existing one).
>
> The main things to define imho are:
> * how to return the answer if using an InOut
> * when the pojo acts as a consumer, how will it receive the answer
> from an InOut exchange it has previsouly sent
>
> I really think there is something to do with beanflow.
> I will try to think about that a bit more.
>
> On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > Just a bit of brainstorming of ideas here.
> >
> > I was looking at this example
> >
> > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > public void myInOutProcessor(MessageExchange me) {
> > // Do something here
> > }
> >
> > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > ParameterMapping.IN_MESSAGE_CONTENT })
> > public void myInOnlyProcessor(Source payload) {
> > // Do something here
> > }
> >
> > and wondering how to simplify a little.
> >
> > My first thought was to use an annotation for each kind of exchange to
> > be supported...
> >
> > @InOnlyExchange @RobustInOnlyExchange
> > public void foo(MessageExchange exchange) {
> > }
> >
> > (I realised we'd get class name clashes so added the 'Exchange'
> > postfix to the annotation names. Then I figured it might be simpler to
> > just use a typesafe API...
> >
> > @ExchangeProcessor
> > public void foo(InOnly exchange) {
> > }
> >
> > @ExchangeProcessor
> > public void bar(RobustInOnly exchange) {
> > }
> >
> > I guess sometimes folks might not want to see/use the exchange or
> > might wish to support multiple patterns for one method so some kinda
> > annotation to indicate the exchange pattern is still useful.
> >
> >
> > Also how about annotating parameters as being bound to the exchange...
> >
> > @ExchangeProcessor
> > public void foo(@MessageProperty('cheese') String foo,
> > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > {
> > }
> >
> > While the @MessageContent may at first not appear that useful, we
> > could allow some automatic tranformations from common types to message
> > contents such as DOM or JAXB marshalling etc
> >
> > e.g.
> >
> > @ExchangeProcessor
> > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> >
> > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> >
> > This would allow folks to process exchanges without using any of the
> > JBI APIs if they wish - or inject a MessageExchange or
> > NormalizedMessage into a parameter if required.
> >
> >
> > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > Great stuff Philip!
> > >
> > > More feedback as I start digesting this fully and reading this whole
> > > thread but my first reaction is could we try to stick to standard
> > > annotations where possible - such as those defined in JSR 250? e.g.
> > >
> > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > >
> > > so
> > >
> > > @ServiceStartup -> @PostConstruct
> > >
> > > @ServiceShutdown -> @PreDestroy
> > >
> > > am also wondering how many of the other annotations are really
> > > required on injected fields - could we just use @Resource to indicate
> > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > sure some of the annotations are required though; am just wondering
> > > how many of them are
> > >
> > >
> > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > used to provide a mechanism for annotating POJO specifically for more
> > > > messaging level operations that the JSR181 service engine is aimed
> > > > for.
> > > >
> > > > The idea is to provide a simple framework to replace the Spring Client
> > > > Toolkit that is now defunt.
> > > >
> > > > Have a look at the idea -
> > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > >
> > > > And all comments/thoughts are welcome!!
> > > >
> > > > P
> > > >
> > >
> > >
> > > --
> > >
> > > James
> > > -------
> > > http://radio.weblogs.com/0112098/
> > >
> >
> >
> > --
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
>
>
> --
> Cheers,
> Guillaume Nodet
>
Re: Thoughts on a JBI POJO Engine
Posted by James Strachan <ja...@gmail.com>.
On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> I would love that, but such annotations are forbidden :(
> Only primitive types, string, class, enums, annotations (or arrays of these)
> can be used as annotations attributes.
Yeah - we could use the String names of fields/properties which are
futures / steps.
@Join(futures = { "answer1", "answer2" })
@Answer()
public Message answer() {
Message m1 = answer1.get();
Message m2 = answer2.get();
...
}
Or the join could be done programatically
@Request
public void receiveRequest(Message message) throws Exception {
request = message;
answer1 = service1.sendAsync(copy(request));
answer2 = service2.sendAsync(copy(request));
// call the answer method when we have both futures joined
join("answer", answer1, answer2);
}
But the annotation based one is cleaner and more loosly coupled
>
> On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > Interesting! I really love the @Destination injection BTW :)
> >
> > I wonder about using futures a little more to make the code a little
> > simpler. Something like the following - where we wrap up an async
> > request-response as a child Step or Future...
> >
> >
> > public class MyWorkflow {
> >
> > Message request;
> > Future<Message> answer1;
> > Future<Message> answer2;
> >
> > @Destination(uri="service:urn:service")
> > private Destination service1;
> >
> > @Destination(uri="service:urn:service")
> > private Destination service2;
> >
> > @Request
> > public void receiveRequest(Message message) throws Exception {
> > request = message;
> >
> > answer1 = service1.sendAsync(copy(request));
> > answer2 = service2.sendAsync(copy(request));
> > }
> >
> >
> > @Join(futures = { answer1, answer2 })
> > @Answer()
> > public Message answer() {
> > Message m1 = answer1.get();
> > Message m2 = answer2.get();
> >
> > // Do something with answer1 and answer2
> > return new Message()
> > }
> > }
> >
> >
> >
> > On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > Here is something i'd like to be able to do.
> > > This is really pseudo code, and some kind of beanflow oriented annotations.
> > >
> > > This service would simply send two concurrent requests and wait for their
> > > answers to reply to the main request. Of course, this would be much easier
> > > if you use syncSend but you would not have a real workflow ;)
> > >
> > > public class MyWorkflow {
> > >
> > > Message request;
> > > Message answer1;
> > > Message answer2;
> > >
> > > @Destination(uri="service:urn:service")
> > > private Destination service1;
> > >
> > > @Destination(uri="service:urn:service")
> > > private Destination service2;
> > >
> > > @Request
> > > @NextStep(steps = { invokeService, invokerService2 }) // This
> > > would auto-fork
> > > public void receiveRequest(Message message) throws Exception {
> > > request = message;
> > > }
> > >
> > > @NextStep(step = receiveService1)
> > > public void invokeService1() {
> > > service1.send(copy(request));
> > > // return response to "receiveService1"
> > > }
> > >
> > > public void receiveService1(Message message) {
> > > answer1 = message;
> > > }
> > >
> > > @NextStep(step = receiveService2)
> > > public void invokeService2() {
> > > service2.send(copy(request));
> > > }
> > >
> > > public void receiveService2(Message message) {
> > > answer2 = message;
> > > }
> > >
> > > @Join(steps = { receiveService1, receiveService2 })
> > > @Answer()
> > > public void answer() {
> > > // Do something with answer1 and answer2
> > > return new Message()
> > > }
> > > }
> > >
> > >
> > > On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > > While I fully agree to simplify the annotations used,
> > > > if you begin to map parameters to properties or xml content,
> > > > you end up to jsr181 component.
> > > >
> > > > I have already planned to add annotations a la jaxws to allow
> > > > properties to be mapped to parameters in jsr181. A kind of
> > > > JBI annotations set for jaxws (compared to the existing SOAP annotations).
> > > > But if we begin to handle xml mapping here, we would end
> > > > with 2 components with little differences.
> > > >
> > > > For example, the
> > > > @ExchangeProcessor
> > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > >
> > > > could be further simplified to
> > > >
> > > > @WebMethod
> > > > public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
> > > >
> > > > which is exactly what the jsr181 component do ;)
> > > >
> > > > Note that the jsr181 component should already by able to
> > > > handle Source types as a parameter (which would map to
> > > > the full payload), and we should be able to add a MessageExchange
> > > > parameter which would receive the exchange without disturbing
> > > > other parameters (xfire already does that for xfire specific
> > > > classes, such as the context).
> > > >
> > > > We need to clearly agree on what we want to show and hide from
> > > > the jbi spec in this component. I don't think we need another SE
> > > > that do xml marshalling (we'd better enhance the existing one).
> > > >
> > > > The main things to define imho are:
> > > > * how to return the answer if using an InOut
> > > > * when the pojo acts as a consumer, how will it receive the answer
> > > > from an InOut exchange it has previsouly sent
> > > >
> > > > I really think there is something to do with beanflow.
> > > > I will try to think about that a bit more.
> > > >
> > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > Just a bit of brainstorming of ideas here.
> > > > >
> > > > > I was looking at this example
> > > > >
> > > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > > > > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > > > > public void myInOutProcessor(MessageExchange me) {
> > > > > // Do something here
> > > > > }
> > > > >
> > > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > > > > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > > > > ParameterMapping.IN_MESSAGE_CONTENT })
> > > > > public void myInOnlyProcessor(Source payload) {
> > > > > // Do something here
> > > > > }
> > > > >
> > > > > and wondering how to simplify a little.
> > > > >
> > > > > My first thought was to use an annotation for each kind of exchange to
> > > > > be supported...
> > > > >
> > > > > @InOnlyExchange @RobustInOnlyExchange
> > > > > public void foo(MessageExchange exchange) {
> > > > > }
> > > > >
> > > > > (I realised we'd get class name clashes so added the 'Exchange'
> > > > > postfix to the annotation names. Then I figured it might be simpler to
> > > > > just use a typesafe API...
> > > > >
> > > > > @ExchangeProcessor
> > > > > public void foo(InOnly exchange) {
> > > > > }
> > > > >
> > > > > @ExchangeProcessor
> > > > > public void bar(RobustInOnly exchange) {
> > > > > }
> > > > >
> > > > > I guess sometimes folks might not want to see/use the exchange or
> > > > > might wish to support multiple patterns for one method so some kinda
> > > > > annotation to indicate the exchange pattern is still useful.
> > > > >
> > > > >
> > > > > Also how about annotating parameters as being bound to the exchange...
> > > > >
> > > > > @ExchangeProcessor
> > > > > public void foo(@MessageProperty('cheese') String foo,
> > > > > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > > > > {
> > > > > }
> > > > >
> > > > > While the @MessageContent may at first not appear that useful, we
> > > > > could allow some automatic tranformations from common types to message
> > > > > contents such as DOM or JAXB marshalling etc
> > > > >
> > > > > e.g.
> > > > >
> > > > > @ExchangeProcessor
> > > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > > >
> > > > > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> > > > >
> > > > > This would allow folks to process exchanges without using any of the
> > > > > JBI APIs if they wish - or inject a MessageExchange or
> > > > > NormalizedMessage into a parameter if required.
> > > > >
> > > > >
> > > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > > Great stuff Philip!
> > > > > >
> > > > > > More feedback as I start digesting this fully and reading this whole
> > > > > > thread but my first reaction is could we try to stick to standard
> > > > > > annotations where possible - such as those defined in JSR 250? e.g.
> > > > > >
> > > > > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > > > > >
> > > > > > so
> > > > > >
> > > > > > @ServiceStartup -> @PostConstruct
> > > > > >
> > > > > > @ServiceShutdown -> @PreDestroy
> > > > > >
> > > > > > am also wondering how many of the other annotations are really
> > > > > > required on injected fields - could we just use @Resource to indicate
> > > > > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > > > > sure some of the annotations are required though; am just wondering
> > > > > > how many of them are
> > > > > >
> > > > > >
> > > > > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > > > > used to provide a mechanism for annotating POJO specifically for more
> > > > > > > messaging level operations that the JSR181 service engine is aimed
> > > > > > > for.
> > > > > > >
> > > > > > > The idea is to provide a simple framework to replace the Spring Client
> > > > > > > Toolkit that is now defunt.
> > > > > > >
> > > > > > > Have a look at the idea -
> > > > > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > > > > >
> > > > > > > And all comments/thoughts are welcome!!
> > > > > > >
> > > > > > > P
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > James
> > > > > > -------
> > > > > > http://radio.weblogs.com/0112098/
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > James
> > > > > -------
> > > > > http://radio.weblogs.com/0112098/
> > > > >
> > > >
> > > >
> > > > --
> > > > Cheers,
> > > > Guillaume Nodet
> > > >
> > >
> > >
> > > --
> > > Cheers,
> > > Guillaume Nodet
> > >
> >
> >
> > --
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
>
>
> --
> Cheers,
> Guillaume Nodet
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: Thoughts on a JBI POJO Engine
Posted by Guillaume Nodet <gn...@gmail.com>.
I would love that, but such annotations are forbidden :(
Only primitive types, string, class, enums, annotations (or arrays of these)
can be used as annotations attributes.
On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> Interesting! I really love the @Destination injection BTW :)
>
> I wonder about using futures a little more to make the code a little
> simpler. Something like the following - where we wrap up an async
> request-response as a child Step or Future...
>
>
> public class MyWorkflow {
>
> Message request;
> Future<Message> answer1;
> Future<Message> answer2;
>
> @Destination(uri="service:urn:service")
> private Destination service1;
>
> @Destination(uri="service:urn:service")
> private Destination service2;
>
> @Request
> public void receiveRequest(Message message) throws Exception {
> request = message;
>
> answer1 = service1.sendAsync(copy(request));
> answer2 = service2.sendAsync(copy(request));
> }
>
>
> @Join(futures = { answer1, answer2 })
> @Answer()
> public Message answer() {
> Message m1 = answer1.get();
> Message m2 = answer2.get();
>
> // Do something with answer1 and answer2
> return new Message()
> }
> }
>
>
>
> On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > Here is something i'd like to be able to do.
> > This is really pseudo code, and some kind of beanflow oriented annotations.
> >
> > This service would simply send two concurrent requests and wait for their
> > answers to reply to the main request. Of course, this would be much easier
> > if you use syncSend but you would not have a real workflow ;)
> >
> > public class MyWorkflow {
> >
> > Message request;
> > Message answer1;
> > Message answer2;
> >
> > @Destination(uri="service:urn:service")
> > private Destination service1;
> >
> > @Destination(uri="service:urn:service")
> > private Destination service2;
> >
> > @Request
> > @NextStep(steps = { invokeService, invokerService2 }) // This
> > would auto-fork
> > public void receiveRequest(Message message) throws Exception {
> > request = message;
> > }
> >
> > @NextStep(step = receiveService1)
> > public void invokeService1() {
> > service1.send(copy(request));
> > // return response to "receiveService1"
> > }
> >
> > public void receiveService1(Message message) {
> > answer1 = message;
> > }
> >
> > @NextStep(step = receiveService2)
> > public void invokeService2() {
> > service2.send(copy(request));
> > }
> >
> > public void receiveService2(Message message) {
> > answer2 = message;
> > }
> >
> > @Join(steps = { receiveService1, receiveService2 })
> > @Answer()
> > public void answer() {
> > // Do something with answer1 and answer2
> > return new Message()
> > }
> > }
> >
> >
> > On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > While I fully agree to simplify the annotations used,
> > > if you begin to map parameters to properties or xml content,
> > > you end up to jsr181 component.
> > >
> > > I have already planned to add annotations a la jaxws to allow
> > > properties to be mapped to parameters in jsr181. A kind of
> > > JBI annotations set for jaxws (compared to the existing SOAP annotations).
> > > But if we begin to handle xml mapping here, we would end
> > > with 2 components with little differences.
> > >
> > > For example, the
> > > @ExchangeProcessor
> > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > >
> > > could be further simplified to
> > >
> > > @WebMethod
> > > public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
> > >
> > > which is exactly what the jsr181 component do ;)
> > >
> > > Note that the jsr181 component should already by able to
> > > handle Source types as a parameter (which would map to
> > > the full payload), and we should be able to add a MessageExchange
> > > parameter which would receive the exchange without disturbing
> > > other parameters (xfire already does that for xfire specific
> > > classes, such as the context).
> > >
> > > We need to clearly agree on what we want to show and hide from
> > > the jbi spec in this component. I don't think we need another SE
> > > that do xml marshalling (we'd better enhance the existing one).
> > >
> > > The main things to define imho are:
> > > * how to return the answer if using an InOut
> > > * when the pojo acts as a consumer, how will it receive the answer
> > > from an InOut exchange it has previsouly sent
> > >
> > > I really think there is something to do with beanflow.
> > > I will try to think about that a bit more.
> > >
> > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > Just a bit of brainstorming of ideas here.
> > > >
> > > > I was looking at this example
> > > >
> > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > > > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > > > public void myInOutProcessor(MessageExchange me) {
> > > > // Do something here
> > > > }
> > > >
> > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > > > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > > > ParameterMapping.IN_MESSAGE_CONTENT })
> > > > public void myInOnlyProcessor(Source payload) {
> > > > // Do something here
> > > > }
> > > >
> > > > and wondering how to simplify a little.
> > > >
> > > > My first thought was to use an annotation for each kind of exchange to
> > > > be supported...
> > > >
> > > > @InOnlyExchange @RobustInOnlyExchange
> > > > public void foo(MessageExchange exchange) {
> > > > }
> > > >
> > > > (I realised we'd get class name clashes so added the 'Exchange'
> > > > postfix to the annotation names. Then I figured it might be simpler to
> > > > just use a typesafe API...
> > > >
> > > > @ExchangeProcessor
> > > > public void foo(InOnly exchange) {
> > > > }
> > > >
> > > > @ExchangeProcessor
> > > > public void bar(RobustInOnly exchange) {
> > > > }
> > > >
> > > > I guess sometimes folks might not want to see/use the exchange or
> > > > might wish to support multiple patterns for one method so some kinda
> > > > annotation to indicate the exchange pattern is still useful.
> > > >
> > > >
> > > > Also how about annotating parameters as being bound to the exchange...
> > > >
> > > > @ExchangeProcessor
> > > > public void foo(@MessageProperty('cheese') String foo,
> > > > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > > > {
> > > > }
> > > >
> > > > While the @MessageContent may at first not appear that useful, we
> > > > could allow some automatic tranformations from common types to message
> > > > contents such as DOM or JAXB marshalling etc
> > > >
> > > > e.g.
> > > >
> > > > @ExchangeProcessor
> > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > >
> > > > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> > > >
> > > > This would allow folks to process exchanges without using any of the
> > > > JBI APIs if they wish - or inject a MessageExchange or
> > > > NormalizedMessage into a parameter if required.
> > > >
> > > >
> > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > Great stuff Philip!
> > > > >
> > > > > More feedback as I start digesting this fully and reading this whole
> > > > > thread but my first reaction is could we try to stick to standard
> > > > > annotations where possible - such as those defined in JSR 250? e.g.
> > > > >
> > > > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > > > >
> > > > > so
> > > > >
> > > > > @ServiceStartup -> @PostConstruct
> > > > >
> > > > > @ServiceShutdown -> @PreDestroy
> > > > >
> > > > > am also wondering how many of the other annotations are really
> > > > > required on injected fields - could we just use @Resource to indicate
> > > > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > > > sure some of the annotations are required though; am just wondering
> > > > > how many of them are
> > > > >
> > > > >
> > > > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > > > used to provide a mechanism for annotating POJO specifically for more
> > > > > > messaging level operations that the JSR181 service engine is aimed
> > > > > > for.
> > > > > >
> > > > > > The idea is to provide a simple framework to replace the Spring Client
> > > > > > Toolkit that is now defunt.
> > > > > >
> > > > > > Have a look at the idea -
> > > > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > > > >
> > > > > > And all comments/thoughts are welcome!!
> > > > > >
> > > > > > P
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > James
> > > > > -------
> > > > > http://radio.weblogs.com/0112098/
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > James
> > > > -------
> > > > http://radio.weblogs.com/0112098/
> > > >
> > >
> > >
> > > --
> > > Cheers,
> > > Guillaume Nodet
> > >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
--
Cheers,
Guillaume Nodet
Re: Thoughts on a JBI POJO Engine
Posted by James Strachan <ja...@gmail.com>.
Interesting! I really love the @Destination injection BTW :)
I wonder about using futures a little more to make the code a little
simpler. Something like the following - where we wrap up an async
request-response as a child Step or Future...
public class MyWorkflow {
Message request;
Future<Message> answer1;
Future<Message> answer2;
@Destination(uri="service:urn:service")
private Destination service1;
@Destination(uri="service:urn:service")
private Destination service2;
@Request
public void receiveRequest(Message message) throws Exception {
request = message;
answer1 = service1.sendAsync(copy(request));
answer2 = service2.sendAsync(copy(request));
}
@Join(futures = { answer1, answer2 })
@Answer()
public Message answer() {
Message m1 = answer1.get();
Message m2 = answer2.get();
// Do something with answer1 and answer2
return new Message()
}
}
On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> Here is something i'd like to be able to do.
> This is really pseudo code, and some kind of beanflow oriented annotations.
>
> This service would simply send two concurrent requests and wait for their
> answers to reply to the main request. Of course, this would be much easier
> if you use syncSend but you would not have a real workflow ;)
>
> public class MyWorkflow {
>
> Message request;
> Message answer1;
> Message answer2;
>
> @Destination(uri="service:urn:service")
> private Destination service1;
>
> @Destination(uri="service:urn:service")
> private Destination service2;
>
> @Request
> @NextStep(steps = { invokeService, invokerService2 }) // This
> would auto-fork
> public void receiveRequest(Message message) throws Exception {
> request = message;
> }
>
> @NextStep(step = receiveService1)
> public void invokeService1() {
> service1.send(copy(request));
> // return response to "receiveService1"
> }
>
> public void receiveService1(Message message) {
> answer1 = message;
> }
>
> @NextStep(step = receiveService2)
> public void invokeService2() {
> service2.send(copy(request));
> }
>
> public void receiveService2(Message message) {
> answer2 = message;
> }
>
> @Join(steps = { receiveService1, receiveService2 })
> @Answer()
> public void answer() {
> // Do something with answer1 and answer2
> return new Message()
> }
> }
>
>
> On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > While I fully agree to simplify the annotations used,
> > if you begin to map parameters to properties or xml content,
> > you end up to jsr181 component.
> >
> > I have already planned to add annotations a la jaxws to allow
> > properties to be mapped to parameters in jsr181. A kind of
> > JBI annotations set for jaxws (compared to the existing SOAP annotations).
> > But if we begin to handle xml mapping here, we would end
> > with 2 components with little differences.
> >
> > For example, the
> > @ExchangeProcessor
> > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> >
> > could be further simplified to
> >
> > @WebMethod
> > public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
> >
> > which is exactly what the jsr181 component do ;)
> >
> > Note that the jsr181 component should already by able to
> > handle Source types as a parameter (which would map to
> > the full payload), and we should be able to add a MessageExchange
> > parameter which would receive the exchange without disturbing
> > other parameters (xfire already does that for xfire specific
> > classes, such as the context).
> >
> > We need to clearly agree on what we want to show and hide from
> > the jbi spec in this component. I don't think we need another SE
> > that do xml marshalling (we'd better enhance the existing one).
> >
> > The main things to define imho are:
> > * how to return the answer if using an InOut
> > * when the pojo acts as a consumer, how will it receive the answer
> > from an InOut exchange it has previsouly sent
> >
> > I really think there is something to do with beanflow.
> > I will try to think about that a bit more.
> >
> > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > Just a bit of brainstorming of ideas here.
> > >
> > > I was looking at this example
> > >
> > > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > > public void myInOutProcessor(MessageExchange me) {
> > > // Do something here
> > > }
> > >
> > > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > > ParameterMapping.IN_MESSAGE_CONTENT })
> > > public void myInOnlyProcessor(Source payload) {
> > > // Do something here
> > > }
> > >
> > > and wondering how to simplify a little.
> > >
> > > My first thought was to use an annotation for each kind of exchange to
> > > be supported...
> > >
> > > @InOnlyExchange @RobustInOnlyExchange
> > > public void foo(MessageExchange exchange) {
> > > }
> > >
> > > (I realised we'd get class name clashes so added the 'Exchange'
> > > postfix to the annotation names. Then I figured it might be simpler to
> > > just use a typesafe API...
> > >
> > > @ExchangeProcessor
> > > public void foo(InOnly exchange) {
> > > }
> > >
> > > @ExchangeProcessor
> > > public void bar(RobustInOnly exchange) {
> > > }
> > >
> > > I guess sometimes folks might not want to see/use the exchange or
> > > might wish to support multiple patterns for one method so some kinda
> > > annotation to indicate the exchange pattern is still useful.
> > >
> > >
> > > Also how about annotating parameters as being bound to the exchange...
> > >
> > > @ExchangeProcessor
> > > public void foo(@MessageProperty('cheese') String foo,
> > > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > > {
> > > }
> > >
> > > While the @MessageContent may at first not appear that useful, we
> > > could allow some automatic tranformations from common types to message
> > > contents such as DOM or JAXB marshalling etc
> > >
> > > e.g.
> > >
> > > @ExchangeProcessor
> > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > >
> > > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> > >
> > > This would allow folks to process exchanges without using any of the
> > > JBI APIs if they wish - or inject a MessageExchange or
> > > NormalizedMessage into a parameter if required.
> > >
> > >
> > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > Great stuff Philip!
> > > >
> > > > More feedback as I start digesting this fully and reading this whole
> > > > thread but my first reaction is could we try to stick to standard
> > > > annotations where possible - such as those defined in JSR 250? e.g.
> > > >
> > > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > > >
> > > > so
> > > >
> > > > @ServiceStartup -> @PostConstruct
> > > >
> > > > @ServiceShutdown -> @PreDestroy
> > > >
> > > > am also wondering how many of the other annotations are really
> > > > required on injected fields - could we just use @Resource to indicate
> > > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > > sure some of the annotations are required though; am just wondering
> > > > how many of them are
> > > >
> > > >
> > > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > > used to provide a mechanism for annotating POJO specifically for more
> > > > > messaging level operations that the JSR181 service engine is aimed
> > > > > for.
> > > > >
> > > > > The idea is to provide a simple framework to replace the Spring Client
> > > > > Toolkit that is now defunt.
> > > > >
> > > > > Have a look at the idea -
> > > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > > >
> > > > > And all comments/thoughts are welcome!!
> > > > >
> > > > > P
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > James
> > > > -------
> > > > http://radio.weblogs.com/0112098/
> > > >
> > >
> > >
> > > --
> > >
> > > James
> > > -------
> > > http://radio.weblogs.com/0112098/
> > >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
>
>
> --
> Cheers,
> Guillaume Nodet
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: Thoughts on a JBI POJO Engine
Posted by Guillaume Nodet <gn...@gmail.com>.
On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> I suppose the more important question is how to implement stateful
> POJO's - what demarcates the life of a POJO if it is stateful?
>
> Do we assume that there is an InOut at the begining and therefore when
> the POJO replies to the original message is life is complete?
That was my thought. It' s the same thing for a bpel process instance.
The instance is created when receiving an incoming request and can be
persisted for long-running workflows.
> I'm
> still not sure about stateful POJO's in the ESB?
SCA also defines statefull POJOs. AFAIK, sca defines several scopes:
* stateless
* request
* session
* module
>
> I would like to see what people think in a large context about this?
I think that stateful pojo are about ease of use for the end user.
Of course, you can achieve the same thing using a stateless pojo and
some maps as done in the EIP patterns.
>
> P
>
> On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > I guess you could reuse the EJB3 annotations for stateless / stateful metadata?
> >
> > On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> > > The destination annotation looks great ! I assume the main body of the
> > > JBI POJO here is the request/answer annotations.
> > >
> > > What I'm not sure about here is the use of fields - so this is a
> > > stateful class? I was thinking that async would be a hybrid of the
> > > destination and the processor?
> > >
> > > public class Example1 {
> > >
> > > @Destination(uri="service:urn:service", request="myFirstRequest")
> > > private Destination service1;
> > >
> > > public void sendRequest() {
> > > service1.send(new Message());
> > > }
> > >
> > > @ExchangeProcessor(request="myFirstRequest")
> > > public void sendRequest(@MessageContent Document in) {
> > > // Got response
> > > }
> > >
> > > }
> > >
> > > The premise being that if you have a async reply then you need to be stateless?
> > >
> > > P
> > >
> > >
> > > On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > > Here is something i'd like to be able to do.
> > > > This is really pseudo code, and some kind of beanflow oriented annotations.
> > > >
> > > > This service would simply send two concurrent requests and wait for their
> > > > answers to reply to the main request. Of course, this would be much easier
> > > > if you use syncSend but you would not have a real workflow ;)
> > > >
> > > > public class MyWorkflow {
> > > >
> > > > Message request;
> > > > Message answer1;
> > > > Message answer2;
> > > >
> > > > @Destination(uri="service:urn:service")
> > > > private Destination service1;
> > > >
> > > > @Destination(uri="service:urn:service")
> > > > private Destination service2;
> > > >
> > > > @Request
> > > > @NextStep(steps = { invokeService, invokerService2 }) // This
> > > > would auto-fork
> > > > public void receiveRequest(Message message) throws Exception {
> > > > request = message;
> > > > }
> > > >
> > > > @NextStep(step = receiveService1)
> > > > public void invokeService1() {
> > > > service1.send(copy(request));
> > > > // return response to "receiveService1"
> > > > }
> > > >
> > > > public void receiveService1(Message message) {
> > > > answer1 = message;
> > > > }
> > > >
> > > > @NextStep(step = receiveService2)
> > > > public void invokeService2() {
> > > > service2.send(copy(request));
> > > > }
> > > >
> > > > public void receiveService2(Message message) {
> > > > answer2 = message;
> > > > }
> > > >
> > > > @Join(steps = { receiveService1, receiveService2 })
> > > > @Answer()
> > > > public void answer() {
> > > > // Do something with answer1 and answer2
> > > > return new Message()
> > > > }
> > > > }
> > > >
> > > >
> > > > On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > > > While I fully agree to simplify the annotations used,
> > > > > if you begin to map parameters to properties or xml content,
> > > > > you end up to jsr181 component.
> > > > >
> > > > > I have already planned to add annotations a la jaxws to allow
> > > > > properties to be mapped to parameters in jsr181. A kind of
> > > > > JBI annotations set for jaxws (compared to the existing SOAP annotations).
> > > > > But if we begin to handle xml mapping here, we would end
> > > > > with 2 components with little differences.
> > > > >
> > > > > For example, the
> > > > > @ExchangeProcessor
> > > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > > >
> > > > > could be further simplified to
> > > > >
> > > > > @WebMethod
> > > > > public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
> > > > >
> > > > > which is exactly what the jsr181 component do ;)
> > > > >
> > > > > Note that the jsr181 component should already by able to
> > > > > handle Source types as a parameter (which would map to
> > > > > the full payload), and we should be able to add a MessageExchange
> > > > > parameter which would receive the exchange without disturbing
> > > > > other parameters (xfire already does that for xfire specific
> > > > > classes, such as the context).
> > > > >
> > > > > We need to clearly agree on what we want to show and hide from
> > > > > the jbi spec in this component. I don't think we need another SE
> > > > > that do xml marshalling (we'd better enhance the existing one).
> > > > >
> > > > > The main things to define imho are:
> > > > > * how to return the answer if using an InOut
> > > > > * when the pojo acts as a consumer, how will it receive the answer
> > > > > from an InOut exchange it has previsouly sent
> > > > >
> > > > > I really think there is something to do with beanflow.
> > > > > I will try to think about that a bit more.
> > > > >
> > > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > > Just a bit of brainstorming of ideas here.
> > > > > >
> > > > > > I was looking at this example
> > > > > >
> > > > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > > > > > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > > > > > public void myInOutProcessor(MessageExchange me) {
> > > > > > // Do something here
> > > > > > }
> > > > > >
> > > > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > > > > > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > > > > > ParameterMapping.IN_MESSAGE_CONTENT })
> > > > > > public void myInOnlyProcessor(Source payload) {
> > > > > > // Do something here
> > > > > > }
> > > > > >
> > > > > > and wondering how to simplify a little.
> > > > > >
> > > > > > My first thought was to use an annotation for each kind of exchange to
> > > > > > be supported...
> > > > > >
> > > > > > @InOnlyExchange @RobustInOnlyExchange
> > > > > > public void foo(MessageExchange exchange) {
> > > > > > }
> > > > > >
> > > > > > (I realised we'd get class name clashes so added the 'Exchange'
> > > > > > postfix to the annotation names. Then I figured it might be simpler to
> > > > > > just use a typesafe API...
> > > > > >
> > > > > > @ExchangeProcessor
> > > > > > public void foo(InOnly exchange) {
> > > > > > }
> > > > > >
> > > > > > @ExchangeProcessor
> > > > > > public void bar(RobustInOnly exchange) {
> > > > > > }
> > > > > >
> > > > > > I guess sometimes folks might not want to see/use the exchange or
> > > > > > might wish to support multiple patterns for one method so some kinda
> > > > > > annotation to indicate the exchange pattern is still useful.
> > > > > >
> > > > > >
> > > > > > Also how about annotating parameters as being bound to the exchange...
> > > > > >
> > > > > > @ExchangeProcessor
> > > > > > public void foo(@MessageProperty('cheese') String foo,
> > > > > > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > > > > > {
> > > > > > }
> > > > > >
> > > > > > While the @MessageContent may at first not appear that useful, we
> > > > > > could allow some automatic tranformations from common types to message
> > > > > > contents such as DOM or JAXB marshalling etc
> > > > > >
> > > > > > e.g.
> > > > > >
> > > > > > @ExchangeProcessor
> > > > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > > > >
> > > > > > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> > > > > >
> > > > > > This would allow folks to process exchanges without using any of the
> > > > > > JBI APIs if they wish - or inject a MessageExchange or
> > > > > > NormalizedMessage into a parameter if required.
> > > > > >
> > > > > >
> > > > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > > > Great stuff Philip!
> > > > > > >
> > > > > > > More feedback as I start digesting this fully and reading this whole
> > > > > > > thread but my first reaction is could we try to stick to standard
> > > > > > > annotations where possible - such as those defined in JSR 250? e.g.
> > > > > > >
> > > > > > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > > > > > >
> > > > > > > so
> > > > > > >
> > > > > > > @ServiceStartup -> @PostConstruct
> > > > > > >
> > > > > > > @ServiceShutdown -> @PreDestroy
> > > > > > >
> > > > > > > am also wondering how many of the other annotations are really
> > > > > > > required on injected fields - could we just use @Resource to indicate
> > > > > > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > > > > > sure some of the annotations are required though; am just wondering
> > > > > > > how many of them are
> > > > > > >
> > > > > > >
> > > > > > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > > > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > > > > > used to provide a mechanism for annotating POJO specifically for more
> > > > > > > > messaging level operations that the JSR181 service engine is aimed
> > > > > > > > for.
> > > > > > > >
> > > > > > > > The idea is to provide a simple framework to replace the Spring Client
> > > > > > > > Toolkit that is now defunt.
> > > > > > > >
> > > > > > > > Have a look at the idea -
> > > > > > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > > > > > >
> > > > > > > > And all comments/thoughts are welcome!!
> > > > > > > >
> > > > > > > > P
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > >
> > > > > > > James
> > > > > > > -------
> > > > > > > http://radio.weblogs.com/0112098/
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > James
> > > > > > -------
> > > > > > http://radio.weblogs.com/0112098/
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Cheers,
> > > > > Guillaume Nodet
> > > > >
> > > >
> > > >
> > > > --
> > > > Cheers,
> > > > Guillaume Nodet
> > > >
> > >
> >
> >
> > --
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
>
--
Cheers,
Guillaume Nodet
Re: Thoughts on a JBI POJO Engine
Posted by Philip Dodds <ph...@gmail.com>.
I suppose the more important question is how to implement stateful
POJO's - what demarcates the life of a POJO if it is stateful?
Do we assume that there is an InOut at the begining and therefore when
the POJO replies to the original message is life is complete? I'm
still not sure about stateful POJO's in the ESB?
I would like to see what people think in a large context about this?
P
On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> I guess you could reuse the EJB3 annotations for stateless / stateful metadata?
>
> On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> > The destination annotation looks great ! I assume the main body of the
> > JBI POJO here is the request/answer annotations.
> >
> > What I'm not sure about here is the use of fields - so this is a
> > stateful class? I was thinking that async would be a hybrid of the
> > destination and the processor?
> >
> > public class Example1 {
> >
> > @Destination(uri="service:urn:service", request="myFirstRequest")
> > private Destination service1;
> >
> > public void sendRequest() {
> > service1.send(new Message());
> > }
> >
> > @ExchangeProcessor(request="myFirstRequest")
> > public void sendRequest(@MessageContent Document in) {
> > // Got response
> > }
> >
> > }
> >
> > The premise being that if you have a async reply then you need to be stateless?
> >
> > P
> >
> >
> > On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > Here is something i'd like to be able to do.
> > > This is really pseudo code, and some kind of beanflow oriented annotations.
> > >
> > > This service would simply send two concurrent requests and wait for their
> > > answers to reply to the main request. Of course, this would be much easier
> > > if you use syncSend but you would not have a real workflow ;)
> > >
> > > public class MyWorkflow {
> > >
> > > Message request;
> > > Message answer1;
> > > Message answer2;
> > >
> > > @Destination(uri="service:urn:service")
> > > private Destination service1;
> > >
> > > @Destination(uri="service:urn:service")
> > > private Destination service2;
> > >
> > > @Request
> > > @NextStep(steps = { invokeService, invokerService2 }) // This
> > > would auto-fork
> > > public void receiveRequest(Message message) throws Exception {
> > > request = message;
> > > }
> > >
> > > @NextStep(step = receiveService1)
> > > public void invokeService1() {
> > > service1.send(copy(request));
> > > // return response to "receiveService1"
> > > }
> > >
> > > public void receiveService1(Message message) {
> > > answer1 = message;
> > > }
> > >
> > > @NextStep(step = receiveService2)
> > > public void invokeService2() {
> > > service2.send(copy(request));
> > > }
> > >
> > > public void receiveService2(Message message) {
> > > answer2 = message;
> > > }
> > >
> > > @Join(steps = { receiveService1, receiveService2 })
> > > @Answer()
> > > public void answer() {
> > > // Do something with answer1 and answer2
> > > return new Message()
> > > }
> > > }
> > >
> > >
> > > On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > > While I fully agree to simplify the annotations used,
> > > > if you begin to map parameters to properties or xml content,
> > > > you end up to jsr181 component.
> > > >
> > > > I have already planned to add annotations a la jaxws to allow
> > > > properties to be mapped to parameters in jsr181. A kind of
> > > > JBI annotations set for jaxws (compared to the existing SOAP annotations).
> > > > But if we begin to handle xml mapping here, we would end
> > > > with 2 components with little differences.
> > > >
> > > > For example, the
> > > > @ExchangeProcessor
> > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > >
> > > > could be further simplified to
> > > >
> > > > @WebMethod
> > > > public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
> > > >
> > > > which is exactly what the jsr181 component do ;)
> > > >
> > > > Note that the jsr181 component should already by able to
> > > > handle Source types as a parameter (which would map to
> > > > the full payload), and we should be able to add a MessageExchange
> > > > parameter which would receive the exchange without disturbing
> > > > other parameters (xfire already does that for xfire specific
> > > > classes, such as the context).
> > > >
> > > > We need to clearly agree on what we want to show and hide from
> > > > the jbi spec in this component. I don't think we need another SE
> > > > that do xml marshalling (we'd better enhance the existing one).
> > > >
> > > > The main things to define imho are:
> > > > * how to return the answer if using an InOut
> > > > * when the pojo acts as a consumer, how will it receive the answer
> > > > from an InOut exchange it has previsouly sent
> > > >
> > > > I really think there is something to do with beanflow.
> > > > I will try to think about that a bit more.
> > > >
> > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > Just a bit of brainstorming of ideas here.
> > > > >
> > > > > I was looking at this example
> > > > >
> > > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > > > > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > > > > public void myInOutProcessor(MessageExchange me) {
> > > > > // Do something here
> > > > > }
> > > > >
> > > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > > > > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > > > > ParameterMapping.IN_MESSAGE_CONTENT })
> > > > > public void myInOnlyProcessor(Source payload) {
> > > > > // Do something here
> > > > > }
> > > > >
> > > > > and wondering how to simplify a little.
> > > > >
> > > > > My first thought was to use an annotation for each kind of exchange to
> > > > > be supported...
> > > > >
> > > > > @InOnlyExchange @RobustInOnlyExchange
> > > > > public void foo(MessageExchange exchange) {
> > > > > }
> > > > >
> > > > > (I realised we'd get class name clashes so added the 'Exchange'
> > > > > postfix to the annotation names. Then I figured it might be simpler to
> > > > > just use a typesafe API...
> > > > >
> > > > > @ExchangeProcessor
> > > > > public void foo(InOnly exchange) {
> > > > > }
> > > > >
> > > > > @ExchangeProcessor
> > > > > public void bar(RobustInOnly exchange) {
> > > > > }
> > > > >
> > > > > I guess sometimes folks might not want to see/use the exchange or
> > > > > might wish to support multiple patterns for one method so some kinda
> > > > > annotation to indicate the exchange pattern is still useful.
> > > > >
> > > > >
> > > > > Also how about annotating parameters as being bound to the exchange...
> > > > >
> > > > > @ExchangeProcessor
> > > > > public void foo(@MessageProperty('cheese') String foo,
> > > > > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > > > > {
> > > > > }
> > > > >
> > > > > While the @MessageContent may at first not appear that useful, we
> > > > > could allow some automatic tranformations from common types to message
> > > > > contents such as DOM or JAXB marshalling etc
> > > > >
> > > > > e.g.
> > > > >
> > > > > @ExchangeProcessor
> > > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > > >
> > > > > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> > > > >
> > > > > This would allow folks to process exchanges without using any of the
> > > > > JBI APIs if they wish - or inject a MessageExchange or
> > > > > NormalizedMessage into a parameter if required.
> > > > >
> > > > >
> > > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > > Great stuff Philip!
> > > > > >
> > > > > > More feedback as I start digesting this fully and reading this whole
> > > > > > thread but my first reaction is could we try to stick to standard
> > > > > > annotations where possible - such as those defined in JSR 250? e.g.
> > > > > >
> > > > > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > > > > >
> > > > > > so
> > > > > >
> > > > > > @ServiceStartup -> @PostConstruct
> > > > > >
> > > > > > @ServiceShutdown -> @PreDestroy
> > > > > >
> > > > > > am also wondering how many of the other annotations are really
> > > > > > required on injected fields - could we just use @Resource to indicate
> > > > > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > > > > sure some of the annotations are required though; am just wondering
> > > > > > how many of them are
> > > > > >
> > > > > >
> > > > > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > > > > used to provide a mechanism for annotating POJO specifically for more
> > > > > > > messaging level operations that the JSR181 service engine is aimed
> > > > > > > for.
> > > > > > >
> > > > > > > The idea is to provide a simple framework to replace the Spring Client
> > > > > > > Toolkit that is now defunt.
> > > > > > >
> > > > > > > Have a look at the idea -
> > > > > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > > > > >
> > > > > > > And all comments/thoughts are welcome!!
> > > > > > >
> > > > > > > P
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > >
> > > > > > James
> > > > > > -------
> > > > > > http://radio.weblogs.com/0112098/
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > James
> > > > > -------
> > > > > http://radio.weblogs.com/0112098/
> > > > >
> > > >
> > > >
> > > > --
> > > > Cheers,
> > > > Guillaume Nodet
> > > >
> > >
> > >
> > > --
> > > Cheers,
> > > Guillaume Nodet
> > >
> >
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
Re: Thoughts on a JBI POJO Engine
Posted by James Strachan <ja...@gmail.com>.
I guess you could reuse the EJB3 annotations for stateless / stateful metadata?
On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> The destination annotation looks great ! I assume the main body of the
> JBI POJO here is the request/answer annotations.
>
> What I'm not sure about here is the use of fields - so this is a
> stateful class? I was thinking that async would be a hybrid of the
> destination and the processor?
>
> public class Example1 {
>
> @Destination(uri="service:urn:service", request="myFirstRequest")
> private Destination service1;
>
> public void sendRequest() {
> service1.send(new Message());
> }
>
> @ExchangeProcessor(request="myFirstRequest")
> public void sendRequest(@MessageContent Document in) {
> // Got response
> }
>
> }
>
> The premise being that if you have a async reply then you need to be stateless?
>
> P
>
>
> On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > Here is something i'd like to be able to do.
> > This is really pseudo code, and some kind of beanflow oriented annotations.
> >
> > This service would simply send two concurrent requests and wait for their
> > answers to reply to the main request. Of course, this would be much easier
> > if you use syncSend but you would not have a real workflow ;)
> >
> > public class MyWorkflow {
> >
> > Message request;
> > Message answer1;
> > Message answer2;
> >
> > @Destination(uri="service:urn:service")
> > private Destination service1;
> >
> > @Destination(uri="service:urn:service")
> > private Destination service2;
> >
> > @Request
> > @NextStep(steps = { invokeService, invokerService2 }) // This
> > would auto-fork
> > public void receiveRequest(Message message) throws Exception {
> > request = message;
> > }
> >
> > @NextStep(step = receiveService1)
> > public void invokeService1() {
> > service1.send(copy(request));
> > // return response to "receiveService1"
> > }
> >
> > public void receiveService1(Message message) {
> > answer1 = message;
> > }
> >
> > @NextStep(step = receiveService2)
> > public void invokeService2() {
> > service2.send(copy(request));
> > }
> >
> > public void receiveService2(Message message) {
> > answer2 = message;
> > }
> >
> > @Join(steps = { receiveService1, receiveService2 })
> > @Answer()
> > public void answer() {
> > // Do something with answer1 and answer2
> > return new Message()
> > }
> > }
> >
> >
> > On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > While I fully agree to simplify the annotations used,
> > > if you begin to map parameters to properties or xml content,
> > > you end up to jsr181 component.
> > >
> > > I have already planned to add annotations a la jaxws to allow
> > > properties to be mapped to parameters in jsr181. A kind of
> > > JBI annotations set for jaxws (compared to the existing SOAP annotations).
> > > But if we begin to handle xml mapping here, we would end
> > > with 2 components with little differences.
> > >
> > > For example, the
> > > @ExchangeProcessor
> > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > >
> > > could be further simplified to
> > >
> > > @WebMethod
> > > public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
> > >
> > > which is exactly what the jsr181 component do ;)
> > >
> > > Note that the jsr181 component should already by able to
> > > handle Source types as a parameter (which would map to
> > > the full payload), and we should be able to add a MessageExchange
> > > parameter which would receive the exchange without disturbing
> > > other parameters (xfire already does that for xfire specific
> > > classes, such as the context).
> > >
> > > We need to clearly agree on what we want to show and hide from
> > > the jbi spec in this component. I don't think we need another SE
> > > that do xml marshalling (we'd better enhance the existing one).
> > >
> > > The main things to define imho are:
> > > * how to return the answer if using an InOut
> > > * when the pojo acts as a consumer, how will it receive the answer
> > > from an InOut exchange it has previsouly sent
> > >
> > > I really think there is something to do with beanflow.
> > > I will try to think about that a bit more.
> > >
> > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > Just a bit of brainstorming of ideas here.
> > > >
> > > > I was looking at this example
> > > >
> > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > > > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > > > public void myInOutProcessor(MessageExchange me) {
> > > > // Do something here
> > > > }
> > > >
> > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > > > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > > > ParameterMapping.IN_MESSAGE_CONTENT })
> > > > public void myInOnlyProcessor(Source payload) {
> > > > // Do something here
> > > > }
> > > >
> > > > and wondering how to simplify a little.
> > > >
> > > > My first thought was to use an annotation for each kind of exchange to
> > > > be supported...
> > > >
> > > > @InOnlyExchange @RobustInOnlyExchange
> > > > public void foo(MessageExchange exchange) {
> > > > }
> > > >
> > > > (I realised we'd get class name clashes so added the 'Exchange'
> > > > postfix to the annotation names. Then I figured it might be simpler to
> > > > just use a typesafe API...
> > > >
> > > > @ExchangeProcessor
> > > > public void foo(InOnly exchange) {
> > > > }
> > > >
> > > > @ExchangeProcessor
> > > > public void bar(RobustInOnly exchange) {
> > > > }
> > > >
> > > > I guess sometimes folks might not want to see/use the exchange or
> > > > might wish to support multiple patterns for one method so some kinda
> > > > annotation to indicate the exchange pattern is still useful.
> > > >
> > > >
> > > > Also how about annotating parameters as being bound to the exchange...
> > > >
> > > > @ExchangeProcessor
> > > > public void foo(@MessageProperty('cheese') String foo,
> > > > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > > > {
> > > > }
> > > >
> > > > While the @MessageContent may at first not appear that useful, we
> > > > could allow some automatic tranformations from common types to message
> > > > contents such as DOM or JAXB marshalling etc
> > > >
> > > > e.g.
> > > >
> > > > @ExchangeProcessor
> > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > >
> > > > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> > > >
> > > > This would allow folks to process exchanges without using any of the
> > > > JBI APIs if they wish - or inject a MessageExchange or
> > > > NormalizedMessage into a parameter if required.
> > > >
> > > >
> > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > Great stuff Philip!
> > > > >
> > > > > More feedback as I start digesting this fully and reading this whole
> > > > > thread but my first reaction is could we try to stick to standard
> > > > > annotations where possible - such as those defined in JSR 250? e.g.
> > > > >
> > > > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > > > >
> > > > > so
> > > > >
> > > > > @ServiceStartup -> @PostConstruct
> > > > >
> > > > > @ServiceShutdown -> @PreDestroy
> > > > >
> > > > > am also wondering how many of the other annotations are really
> > > > > required on injected fields - could we just use @Resource to indicate
> > > > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > > > sure some of the annotations are required though; am just wondering
> > > > > how many of them are
> > > > >
> > > > >
> > > > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > > > used to provide a mechanism for annotating POJO specifically for more
> > > > > > messaging level operations that the JSR181 service engine is aimed
> > > > > > for.
> > > > > >
> > > > > > The idea is to provide a simple framework to replace the Spring Client
> > > > > > Toolkit that is now defunt.
> > > > > >
> > > > > > Have a look at the idea -
> > > > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > > > >
> > > > > > And all comments/thoughts are welcome!!
> > > > > >
> > > > > > P
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > James
> > > > > -------
> > > > > http://radio.weblogs.com/0112098/
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > James
> > > > -------
> > > > http://radio.weblogs.com/0112098/
> > > >
> > >
> > >
> > > --
> > > Cheers,
> > > Guillaume Nodet
> > >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: Thoughts on a JBI POJO Engine
Posted by Guillaume Nodet <gn...@gmail.com>.
If you use synchronous send, you can be stateless, as the whole flow
will be executed in one step from receiving the request to answering it.
However, if you use asynchronous, you need to keep data so the bean
is statefull and you need one bean per invocation.
If you send 2 requests to 2 services, you need to keep one answer until
you receive the other one => stateful.
I like your request parameter on the destination / processor.
The only drawback is that you can only use a destination once,
but it makes things much cleaner.
On 8/21/06, Philip Dodds <ph...@gmail.com> wrote:
> The destination annotation looks great ! I assume the main body of the
> JBI POJO here is the request/answer annotations.
>
> What I'm not sure about here is the use of fields - so this is a
> stateful class? I was thinking that async would be a hybrid of the
> destination and the processor?
>
> public class Example1 {
>
> @Destination(uri="service:urn:service", request="myFirstRequest")
> private Destination service1;
>
> public void sendRequest() {
> service1.send(new Message());
> }
>
> @ExchangeProcessor(request="myFirstRequest")
> public void sendRequest(@MessageContent Document in) {
> // Got response
> }
>
> }
>
> The premise being that if you have a async reply then you need to be stateless?
>
> P
>
>
> On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > Here is something i'd like to be able to do.
> > This is really pseudo code, and some kind of beanflow oriented annotations.
> >
> > This service would simply send two concurrent requests and wait for their
> > answers to reply to the main request. Of course, this would be much easier
> > if you use syncSend but you would not have a real workflow ;)
> >
> > public class MyWorkflow {
> >
> > Message request;
> > Message answer1;
> > Message answer2;
> >
> > @Destination(uri="service:urn:service")
> > private Destination service1;
> >
> > @Destination(uri="service:urn:service")
> > private Destination service2;
> >
> > @Request
> > @NextStep(steps = { invokeService, invokerService2 }) // This
> > would auto-fork
> > public void receiveRequest(Message message) throws Exception {
> > request = message;
> > }
> >
> > @NextStep(step = receiveService1)
> > public void invokeService1() {
> > service1.send(copy(request));
> > // return response to "receiveService1"
> > }
> >
> > public void receiveService1(Message message) {
> > answer1 = message;
> > }
> >
> > @NextStep(step = receiveService2)
> > public void invokeService2() {
> > service2.send(copy(request));
> > }
> >
> > public void receiveService2(Message message) {
> > answer2 = message;
> > }
> >
> > @Join(steps = { receiveService1, receiveService2 })
> > @Answer()
> > public void answer() {
> > // Do something with answer1 and answer2
> > return new Message()
> > }
> > }
> >
> >
> > On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > > While I fully agree to simplify the annotations used,
> > > if you begin to map parameters to properties or xml content,
> > > you end up to jsr181 component.
> > >
> > > I have already planned to add annotations a la jaxws to allow
> > > properties to be mapped to parameters in jsr181. A kind of
> > > JBI annotations set for jaxws (compared to the existing SOAP annotations).
> > > But if we begin to handle xml mapping here, we would end
> > > with 2 components with little differences.
> > >
> > > For example, the
> > > @ExchangeProcessor
> > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > >
> > > could be further simplified to
> > >
> > > @WebMethod
> > > public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
> > >
> > > which is exactly what the jsr181 component do ;)
> > >
> > > Note that the jsr181 component should already by able to
> > > handle Source types as a parameter (which would map to
> > > the full payload), and we should be able to add a MessageExchange
> > > parameter which would receive the exchange without disturbing
> > > other parameters (xfire already does that for xfire specific
> > > classes, such as the context).
> > >
> > > We need to clearly agree on what we want to show and hide from
> > > the jbi spec in this component. I don't think we need another SE
> > > that do xml marshalling (we'd better enhance the existing one).
> > >
> > > The main things to define imho are:
> > > * how to return the answer if using an InOut
> > > * when the pojo acts as a consumer, how will it receive the answer
> > > from an InOut exchange it has previsouly sent
> > >
> > > I really think there is something to do with beanflow.
> > > I will try to think about that a bit more.
> > >
> > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > Just a bit of brainstorming of ideas here.
> > > >
> > > > I was looking at this example
> > > >
> > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > > > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > > > public void myInOutProcessor(MessageExchange me) {
> > > > // Do something here
> > > > }
> > > >
> > > > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > > > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > > > ParameterMapping.IN_MESSAGE_CONTENT })
> > > > public void myInOnlyProcessor(Source payload) {
> > > > // Do something here
> > > > }
> > > >
> > > > and wondering how to simplify a little.
> > > >
> > > > My first thought was to use an annotation for each kind of exchange to
> > > > be supported...
> > > >
> > > > @InOnlyExchange @RobustInOnlyExchange
> > > > public void foo(MessageExchange exchange) {
> > > > }
> > > >
> > > > (I realised we'd get class name clashes so added the 'Exchange'
> > > > postfix to the annotation names. Then I figured it might be simpler to
> > > > just use a typesafe API...
> > > >
> > > > @ExchangeProcessor
> > > > public void foo(InOnly exchange) {
> > > > }
> > > >
> > > > @ExchangeProcessor
> > > > public void bar(RobustInOnly exchange) {
> > > > }
> > > >
> > > > I guess sometimes folks might not want to see/use the exchange or
> > > > might wish to support multiple patterns for one method so some kinda
> > > > annotation to indicate the exchange pattern is still useful.
> > > >
> > > >
> > > > Also how about annotating parameters as being bound to the exchange...
> > > >
> > > > @ExchangeProcessor
> > > > public void foo(@MessageProperty('cheese') String foo,
> > > > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > > > {
> > > > }
> > > >
> > > > While the @MessageContent may at first not appear that useful, we
> > > > could allow some automatic tranformations from common types to message
> > > > contents such as DOM or JAXB marshalling etc
> > > >
> > > > e.g.
> > > >
> > > > @ExchangeProcessor
> > > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > > >
> > > > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> > > >
> > > > This would allow folks to process exchanges without using any of the
> > > > JBI APIs if they wish - or inject a MessageExchange or
> > > > NormalizedMessage into a parameter if required.
> > > >
> > > >
> > > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > > Great stuff Philip!
> > > > >
> > > > > More feedback as I start digesting this fully and reading this whole
> > > > > thread but my first reaction is could we try to stick to standard
> > > > > annotations where possible - such as those defined in JSR 250? e.g.
> > > > >
> > > > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > > > >
> > > > > so
> > > > >
> > > > > @ServiceStartup -> @PostConstruct
> > > > >
> > > > > @ServiceShutdown -> @PreDestroy
> > > > >
> > > > > am also wondering how many of the other annotations are really
> > > > > required on injected fields - could we just use @Resource to indicate
> > > > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > > > sure some of the annotations are required though; am just wondering
> > > > > how many of them are
> > > > >
> > > > >
> > > > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > > > used to provide a mechanism for annotating POJO specifically for more
> > > > > > messaging level operations that the JSR181 service engine is aimed
> > > > > > for.
> > > > > >
> > > > > > The idea is to provide a simple framework to replace the Spring Client
> > > > > > Toolkit that is now defunt.
> > > > > >
> > > > > > Have a look at the idea -
> > > > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > > > >
> > > > > > And all comments/thoughts are welcome!!
> > > > > >
> > > > > > P
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > >
> > > > > James
> > > > > -------
> > > > > http://radio.weblogs.com/0112098/
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > James
> > > > -------
> > > > http://radio.weblogs.com/0112098/
> > > >
> > >
> > >
> > > --
> > > Cheers,
> > > Guillaume Nodet
> > >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
>
--
Cheers,
Guillaume Nodet
Re: Thoughts on a JBI POJO Engine
Posted by Philip Dodds <ph...@gmail.com>.
The destination annotation looks great ! I assume the main body of the
JBI POJO here is the request/answer annotations.
What I'm not sure about here is the use of fields - so this is a
stateful class? I was thinking that async would be a hybrid of the
destination and the processor?
public class Example1 {
@Destination(uri="service:urn:service", request="myFirstRequest")
private Destination service1;
public void sendRequest() {
service1.send(new Message());
}
@ExchangeProcessor(request="myFirstRequest")
public void sendRequest(@MessageContent Document in) {
// Got response
}
}
The premise being that if you have a async reply then you need to be stateless?
P
On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> Here is something i'd like to be able to do.
> This is really pseudo code, and some kind of beanflow oriented annotations.
>
> This service would simply send two concurrent requests and wait for their
> answers to reply to the main request. Of course, this would be much easier
> if you use syncSend but you would not have a real workflow ;)
>
> public class MyWorkflow {
>
> Message request;
> Message answer1;
> Message answer2;
>
> @Destination(uri="service:urn:service")
> private Destination service1;
>
> @Destination(uri="service:urn:service")
> private Destination service2;
>
> @Request
> @NextStep(steps = { invokeService, invokerService2 }) // This
> would auto-fork
> public void receiveRequest(Message message) throws Exception {
> request = message;
> }
>
> @NextStep(step = receiveService1)
> public void invokeService1() {
> service1.send(copy(request));
> // return response to "receiveService1"
> }
>
> public void receiveService1(Message message) {
> answer1 = message;
> }
>
> @NextStep(step = receiveService2)
> public void invokeService2() {
> service2.send(copy(request));
> }
>
> public void receiveService2(Message message) {
> answer2 = message;
> }
>
> @Join(steps = { receiveService1, receiveService2 })
> @Answer()
> public void answer() {
> // Do something with answer1 and answer2
> return new Message()
> }
> }
>
>
> On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> > While I fully agree to simplify the annotations used,
> > if you begin to map parameters to properties or xml content,
> > you end up to jsr181 component.
> >
> > I have already planned to add annotations a la jaxws to allow
> > properties to be mapped to parameters in jsr181. A kind of
> > JBI annotations set for jaxws (compared to the existing SOAP annotations).
> > But if we begin to handle xml mapping here, we would end
> > with 2 components with little differences.
> >
> > For example, the
> > @ExchangeProcessor
> > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> >
> > could be further simplified to
> >
> > @WebMethod
> > public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
> >
> > which is exactly what the jsr181 component do ;)
> >
> > Note that the jsr181 component should already by able to
> > handle Source types as a parameter (which would map to
> > the full payload), and we should be able to add a MessageExchange
> > parameter which would receive the exchange without disturbing
> > other parameters (xfire already does that for xfire specific
> > classes, such as the context).
> >
> > We need to clearly agree on what we want to show and hide from
> > the jbi spec in this component. I don't think we need another SE
> > that do xml marshalling (we'd better enhance the existing one).
> >
> > The main things to define imho are:
> > * how to return the answer if using an InOut
> > * when the pojo acts as a consumer, how will it receive the answer
> > from an InOut exchange it has previsouly sent
> >
> > I really think there is something to do with beanflow.
> > I will try to think about that a bit more.
> >
> > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > Just a bit of brainstorming of ideas here.
> > >
> > > I was looking at this example
> > >
> > > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > > public void myInOutProcessor(MessageExchange me) {
> > > // Do something here
> > > }
> > >
> > > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > > ParameterMapping.IN_MESSAGE_CONTENT })
> > > public void myInOnlyProcessor(Source payload) {
> > > // Do something here
> > > }
> > >
> > > and wondering how to simplify a little.
> > >
> > > My first thought was to use an annotation for each kind of exchange to
> > > be supported...
> > >
> > > @InOnlyExchange @RobustInOnlyExchange
> > > public void foo(MessageExchange exchange) {
> > > }
> > >
> > > (I realised we'd get class name clashes so added the 'Exchange'
> > > postfix to the annotation names. Then I figured it might be simpler to
> > > just use a typesafe API...
> > >
> > > @ExchangeProcessor
> > > public void foo(InOnly exchange) {
> > > }
> > >
> > > @ExchangeProcessor
> > > public void bar(RobustInOnly exchange) {
> > > }
> > >
> > > I guess sometimes folks might not want to see/use the exchange or
> > > might wish to support multiple patterns for one method so some kinda
> > > annotation to indicate the exchange pattern is still useful.
> > >
> > >
> > > Also how about annotating parameters as being bound to the exchange...
> > >
> > > @ExchangeProcessor
> > > public void foo(@MessageProperty('cheese') String foo,
> > > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > > {
> > > }
> > >
> > > While the @MessageContent may at first not appear that useful, we
> > > could allow some automatic tranformations from common types to message
> > > contents such as DOM or JAXB marshalling etc
> > >
> > > e.g.
> > >
> > > @ExchangeProcessor
> > > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> > >
> > > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> > >
> > > This would allow folks to process exchanges without using any of the
> > > JBI APIs if they wish - or inject a MessageExchange or
> > > NormalizedMessage into a parameter if required.
> > >
> > >
> > > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > > Great stuff Philip!
> > > >
> > > > More feedback as I start digesting this fully and reading this whole
> > > > thread but my first reaction is could we try to stick to standard
> > > > annotations where possible - such as those defined in JSR 250? e.g.
> > > >
> > > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > > >
> > > > so
> > > >
> > > > @ServiceStartup -> @PostConstruct
> > > >
> > > > @ServiceShutdown -> @PreDestroy
> > > >
> > > > am also wondering how many of the other annotations are really
> > > > required on injected fields - could we just use @Resource to indicate
> > > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > > sure some of the annotations are required though; am just wondering
> > > > how many of them are
> > > >
> > > >
> > > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > > used to provide a mechanism for annotating POJO specifically for more
> > > > > messaging level operations that the JSR181 service engine is aimed
> > > > > for.
> > > > >
> > > > > The idea is to provide a simple framework to replace the Spring Client
> > > > > Toolkit that is now defunt.
> > > > >
> > > > > Have a look at the idea -
> > > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > > >
> > > > > And all comments/thoughts are welcome!!
> > > > >
> > > > > P
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > James
> > > > -------
> > > > http://radio.weblogs.com/0112098/
> > > >
> > >
> > >
> > > --
> > >
> > > James
> > > -------
> > > http://radio.weblogs.com/0112098/
> > >
> >
> >
> > --
> > Cheers,
> > Guillaume Nodet
> >
>
>
> --
> Cheers,
> Guillaume Nodet
>
Re: Thoughts on a JBI POJO Engine
Posted by Guillaume Nodet <gn...@gmail.com>.
Here is something i'd like to be able to do.
This is really pseudo code, and some kind of beanflow oriented annotations.
This service would simply send two concurrent requests and wait for their
answers to reply to the main request. Of course, this would be much easier
if you use syncSend but you would not have a real workflow ;)
public class MyWorkflow {
Message request;
Message answer1;
Message answer2;
@Destination(uri="service:urn:service")
private Destination service1;
@Destination(uri="service:urn:service")
private Destination service2;
@Request
@NextStep(steps = { invokeService, invokerService2 }) // This
would auto-fork
public void receiveRequest(Message message) throws Exception {
request = message;
}
@NextStep(step = receiveService1)
public void invokeService1() {
service1.send(copy(request));
// return response to "receiveService1"
}
public void receiveService1(Message message) {
answer1 = message;
}
@NextStep(step = receiveService2)
public void invokeService2() {
service2.send(copy(request));
}
public void receiveService2(Message message) {
answer2 = message;
}
@Join(steps = { receiveService1, receiveService2 })
@Answer()
public void answer() {
// Do something with answer1 and answer2
return new Message()
}
}
On 8/21/06, Guillaume Nodet <gn...@gmail.com> wrote:
> While I fully agree to simplify the annotations used,
> if you begin to map parameters to properties or xml content,
> you end up to jsr181 component.
>
> I have already planned to add annotations a la jaxws to allow
> properties to be mapped to parameters in jsr181. A kind of
> JBI annotations set for jaxws (compared to the existing SOAP annotations).
> But if we begin to handle xml mapping here, we would end
> with 2 components with little differences.
>
> For example, the
> @ExchangeProcessor
> public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
>
> could be further simplified to
>
> @WebMethod
> public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
>
> which is exactly what the jsr181 component do ;)
>
> Note that the jsr181 component should already by able to
> handle Source types as a parameter (which would map to
> the full payload), and we should be able to add a MessageExchange
> parameter which would receive the exchange without disturbing
> other parameters (xfire already does that for xfire specific
> classes, such as the context).
>
> We need to clearly agree on what we want to show and hide from
> the jbi spec in this component. I don't think we need another SE
> that do xml marshalling (we'd better enhance the existing one).
>
> The main things to define imho are:
> * how to return the answer if using an InOut
> * when the pojo acts as a consumer, how will it receive the answer
> from an InOut exchange it has previsouly sent
>
> I really think there is something to do with beanflow.
> I will try to think about that a bit more.
>
> On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > Just a bit of brainstorming of ideas here.
> >
> > I was looking at this example
> >
> > @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> > parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> > public void myInOutProcessor(MessageExchange me) {
> > // Do something here
> > }
> >
> > @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> > MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> > ParameterMapping.IN_MESSAGE_CONTENT })
> > public void myInOnlyProcessor(Source payload) {
> > // Do something here
> > }
> >
> > and wondering how to simplify a little.
> >
> > My first thought was to use an annotation for each kind of exchange to
> > be supported...
> >
> > @InOnlyExchange @RobustInOnlyExchange
> > public void foo(MessageExchange exchange) {
> > }
> >
> > (I realised we'd get class name clashes so added the 'Exchange'
> > postfix to the annotation names. Then I figured it might be simpler to
> > just use a typesafe API...
> >
> > @ExchangeProcessor
> > public void foo(InOnly exchange) {
> > }
> >
> > @ExchangeProcessor
> > public void bar(RobustInOnly exchange) {
> > }
> >
> > I guess sometimes folks might not want to see/use the exchange or
> > might wish to support multiple patterns for one method so some kinda
> > annotation to indicate the exchange pattern is still useful.
> >
> >
> > Also how about annotating parameters as being bound to the exchange...
> >
> > @ExchangeProcessor
> > public void foo(@MessageProperty('cheese') String foo,
> > @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> > {
> > }
> >
> > While the @MessageContent may at first not appear that useful, we
> > could allow some automatic tranformations from common types to message
> > contents such as DOM or JAXB marshalling etc
> >
> > e.g.
> >
> > @ExchangeProcessor
> > public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
> >
> > where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
> >
> > This would allow folks to process exchanges without using any of the
> > JBI APIs if they wish - or inject a MessageExchange or
> > NormalizedMessage into a parameter if required.
> >
> >
> > On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > > Great stuff Philip!
> > >
> > > More feedback as I start digesting this fully and reading this whole
> > > thread but my first reaction is could we try to stick to standard
> > > annotations where possible - such as those defined in JSR 250? e.g.
> > >
> > > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> > >
> > > so
> > >
> > > @ServiceStartup -> @PostConstruct
> > >
> > > @ServiceShutdown -> @PreDestroy
> > >
> > > am also wondering how many of the other annotations are really
> > > required on injected fields - could we just use @Resource to indicate
> > > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > > sure some of the annotations are required though; am just wondering
> > > how many of them are
> > >
> > >
> > > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > > used to provide a mechanism for annotating POJO specifically for more
> > > > messaging level operations that the JSR181 service engine is aimed
> > > > for.
> > > >
> > > > The idea is to provide a simple framework to replace the Spring Client
> > > > Toolkit that is now defunt.
> > > >
> > > > Have a look at the idea -
> > > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > > >
> > > > And all comments/thoughts are welcome!!
> > > >
> > > > P
> > > >
> > >
> > >
> > > --
> > >
> > > James
> > > -------
> > > http://radio.weblogs.com/0112098/
> > >
> >
> >
> > --
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
>
>
> --
> Cheers,
> Guillaume Nodet
>
--
Cheers,
Guillaume Nodet
Re: Thoughts on a JBI POJO Engine
Posted by Guillaume Nodet <gn...@gmail.com>.
While I fully agree to simplify the annotations used,
if you begin to map parameters to properties or xml content,
you end up to jsr181 component.
I have already planned to add annotations a la jaxws to allow
properties to be mapped to parameters in jsr181. A kind of
JBI annotations set for jaxws (compared to the existing SOAP annotations).
But if we begin to handle xml mapping here, we would end
with 2 components with little differences.
For example, the
@ExchangeProcessor
public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
could be further simplified to
@WebMethod
public SomeResponse doSomething(@WebParam SomeRequest foo) { ... }
which is exactly what the jsr181 component do ;)
Note that the jsr181 component should already by able to
handle Source types as a parameter (which would map to
the full payload), and we should be able to add a MessageExchange
parameter which would receive the exchange without disturbing
other parameters (xfire already does that for xfire specific
classes, such as the context).
We need to clearly agree on what we want to show and hide from
the jbi spec in this component. I don't think we need another SE
that do xml marshalling (we'd better enhance the existing one).
The main things to define imho are:
* how to return the answer if using an InOut
* when the pojo acts as a consumer, how will it receive the answer
from an InOut exchange it has previsouly sent
I really think there is something to do with beanflow.
I will try to think about that a bit more.
On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> Just a bit of brainstorming of ideas here.
>
> I was looking at this example
>
> @ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
> parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
> public void myInOutProcessor(MessageExchange me) {
> // Do something here
> }
>
> @ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
> MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
> ParameterMapping.IN_MESSAGE_CONTENT })
> public void myInOnlyProcessor(Source payload) {
> // Do something here
> }
>
> and wondering how to simplify a little.
>
> My first thought was to use an annotation for each kind of exchange to
> be supported...
>
> @InOnlyExchange @RobustInOnlyExchange
> public void foo(MessageExchange exchange) {
> }
>
> (I realised we'd get class name clashes so added the 'Exchange'
> postfix to the annotation names. Then I figured it might be simpler to
> just use a typesafe API...
>
> @ExchangeProcessor
> public void foo(InOnly exchange) {
> }
>
> @ExchangeProcessor
> public void bar(RobustInOnly exchange) {
> }
>
> I guess sometimes folks might not want to see/use the exchange or
> might wish to support multiple patterns for one method so some kinda
> annotation to indicate the exchange pattern is still useful.
>
>
> Also how about annotating parameters as being bound to the exchange...
>
> @ExchangeProcessor
> public void foo(@MessageProperty('cheese') String foo,
> @ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
> {
> }
>
> While the @MessageContent may at first not appear that useful, we
> could allow some automatic tranformations from common types to message
> contents such as DOM or JAXB marshalling etc
>
> e.g.
>
> @ExchangeProcessor
> public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
>
> where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
>
> This would allow folks to process exchanges without using any of the
> JBI APIs if they wish - or inject a MessageExchange or
> NormalizedMessage into a parameter if required.
>
>
> On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> > Great stuff Philip!
> >
> > More feedback as I start digesting this fully and reading this whole
> > thread but my first reaction is could we try to stick to standard
> > annotations where possible - such as those defined in JSR 250? e.g.
> >
> > http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
> >
> > so
> >
> > @ServiceStartup -> @PostConstruct
> >
> > @ServiceShutdown -> @PreDestroy
> >
> > am also wondering how many of the other annotations are really
> > required on injected fields - could we just use @Resource to indicate
> > stuff that is mandatory to be dependency injected (like EJB3s). I'm
> > sure some of the annotations are required though; am just wondering
> > how many of them are
> >
> >
> > On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > > I have knocked up some thoughts on a JBI POJO engine that could be
> > > used to provide a mechanism for annotating POJO specifically for more
> > > messaging level operations that the JSR181 service engine is aimed
> > > for.
> > >
> > > The idea is to provide a simple framework to replace the Spring Client
> > > Toolkit that is now defunt.
> > >
> > > Have a look at the idea -
> > > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> > >
> > > And all comments/thoughts are welcome!!
> > >
> > > P
> > >
> >
> >
> > --
> >
> > James
> > -------
> > http://radio.weblogs.com/0112098/
> >
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
--
Cheers,
Guillaume Nodet
Re: Thoughts on a JBI POJO Engine
Posted by James Strachan <ja...@gmail.com>.
Just a bit of brainstorming of ideas here.
I was looking at this example
@ExchangeProcessor(patterns = { MessageExchangePattern.INOUT },
parameterMappings = { ParameterMapping.IN_MESSAGE_CONTENT })
public void myInOutProcessor(MessageExchange me) {
// Do something here
}
@ExchangeProcessor(patterns = { MessageExchangePattern.INONLY,
MessageExchangePattern.ROBUSTINOULY }, parameterMappings = {
ParameterMapping.IN_MESSAGE_CONTENT })
public void myInOnlyProcessor(Source payload) {
// Do something here
}
and wondering how to simplify a little.
My first thought was to use an annotation for each kind of exchange to
be supported...
@InOnlyExchange @RobustInOnlyExchange
public void foo(MessageExchange exchange) {
}
(I realised we'd get class name clashes so added the 'Exchange'
postfix to the annotation names. Then I figured it might be simpler to
just use a typesafe API...
@ExchangeProcessor
public void foo(InOnly exchange) {
}
@ExchangeProcessor
public void bar(RobustInOnly exchange) {
}
I guess sometimes folks might not want to see/use the exchange or
might wish to support multiple patterns for one method so some kinda
annotation to indicate the exchange pattern is still useful.
Also how about annotating parameters as being bound to the exchange...
@ExchangeProcessor
public void foo(@MessageProperty('cheese') String foo,
@ExchangeProperty("beer") Integer bar, @MessageContent Source payload)
{
}
While the @MessageContent may at first not appear that useful, we
could allow some automatic tranformations from common types to message
contents such as DOM or JAXB marshalling etc
e.g.
@ExchangeProcessor
public SomeResponse doSomething(@MessageBody SomeRequest foo) { ... }
where SomeRequest and SomeResponse could be marshalled to/from Source via JAXB2.
This would allow folks to process exchanges without using any of the
JBI APIs if they wish - or inject a MessageExchange or
NormalizedMessage into a parameter if required.
On 8/21/06, James Strachan <ja...@gmail.com> wrote:
> Great stuff Philip!
>
> More feedback as I start digesting this fully and reading this whole
> thread but my first reaction is could we try to stick to standard
> annotations where possible - such as those defined in JSR 250? e.g.
>
> http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
>
> so
>
> @ServiceStartup -> @PostConstruct
>
> @ServiceShutdown -> @PreDestroy
>
> am also wondering how many of the other annotations are really
> required on injected fields - could we just use @Resource to indicate
> stuff that is mandatory to be dependency injected (like EJB3s). I'm
> sure some of the annotations are required though; am just wondering
> how many of them are
>
>
> On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> > I have knocked up some thoughts on a JBI POJO engine that could be
> > used to provide a mechanism for annotating POJO specifically for more
> > messaging level operations that the JSR181 service engine is aimed
> > for.
> >
> > The idea is to provide a simple framework to replace the Spring Client
> > Toolkit that is now defunt.
> >
> > Have a look at the idea -
> > http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
> >
> > And all comments/thoughts are welcome!!
> >
> > P
> >
>
>
> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>
--
James
-------
http://radio.weblogs.com/0112098/
Re: Thoughts on a JBI POJO Engine
Posted by James Strachan <ja...@gmail.com>.
Great stuff Philip!
More feedback as I start digesting this fully and reading this whole
thread but my first reaction is could we try to stick to standard
annotations where possible - such as those defined in JSR 250? e.g.
http://geronimo.apache.org/xbean/annotation-based-dependency-injection.html
so
@ServiceStartup -> @PostConstruct
@ServiceShutdown -> @PreDestroy
am also wondering how many of the other annotations are really
required on injected fields - could we just use @Resource to indicate
stuff that is mandatory to be dependency injected (like EJB3s). I'm
sure some of the annotations are required though; am just wondering
how many of them are
On 8/18/06, Philip Dodds <ph...@gmail.com> wrote:
> I have knocked up some thoughts on a JBI POJO engine that could be
> used to provide a mechanism for annotating POJO specifically for more
> messaging level operations that the JSR181 service engine is aimed
> for.
>
> The idea is to provide a simple framework to replace the Spring Client
> Toolkit that is now defunt.
>
> Have a look at the idea -
> http://goopen.org/confluence/display/SM/JBI+Pojo+Service+Engine
>
> And all comments/thoughts are welcome!!
>
> P
>
--
James
-------
http://radio.weblogs.com/0112098/