On 19 Aug 2005, at 10:47, Mats Norén wrote:
[EMAIL PROTECTED] wrote:
Hi Mats
Sorry for the delay getting to you, been a bit hectic lately...
I can understand why :) How many projects are you involved in at
the moment? :)
A couple :) But ServiceMix and ActiveMQ are my main focus these days.
If you could use either of those directly you could just use
either dependency injection or inheritance to switch in a
different HttpMarshaler to handle different ways of dealing with
the S/MIME encoding and deciding how to turn them into a
NormalizedMessage and back again. i.e. you could extend
HttpMarshaler to decide how to extract the body & attachments and
what NormalizedMessage properties to set and so forth.
To handle validation, you could put this into your HttpMarshaler
or add it in a pipeline using a ValidationComponent.
And when you say pipeline you mean the servicemix.xml where I
configure the JBI-container with components and services?
Yeah, you can wire the output of one component into the input of
another component to create pipelines. Or you can use a single
component as a pipeilne; e.g. using BPEL or a script or the XPath
Router can make multiple invocations, using XPath to decide which
services to invoke when etc.
http://servicemix.org/XPath+Router
e.g.
<xsl:if test="/foo/bar == 'abc'">
<jbi:forward service="cheese"/>
</xsl:if>
<jbi:invoke service="whatnot">
<someBody foo="{/foo/bar}"/>
</jbi:invoke>
The part I'm a little confused by is "Based on a property in the
header of the first mime-part the request is either async. or
sync.". Inside a Servlet call, you can either perform an InOnly
(one way) request into JBI or you can perform an InOut, blocking
until the result comes back, then returning the answer to the
HTTP client. In both cases the Servlet is synchronous, as
Servlets have to be. So when you said sync/async did you mean
InOnly v InOut right? i.e. fire and forget versus blocking
request response?
Exactly. I'm thinking about creating two different services, Sync
and Async and route the NMS to the appropriate service. In your
opinion, would it be best to just let the servlet create an InOut
to a router component that does the switch between sync and async
based on the NMS?
I guess that's cleaner yes. I guess from the Servlet perspective, you
can do an InOut into the NMS then based on the routing/services
available, there may be no response (the service invoked could return
immediately) or there could be a slower, more latent response. From
the servlet's perspective it just does an InOut and may have some
output. So long as the HttpMarshaler can deal with this, you're fine.
(I think it is right now).
I mean is it preferable to decouple the sync/async routing further
from the BindingServlet?
If I create an InOut in the Servlet and then decide to do async
processing I would have to create a new MEP using InOnly and copy
the received message, right?
If you want to get the response and return it to the HTTP client,
then you have to block. If you don't care about the HTTP client
getting the response, but some other destination does (e.g. Jabber or
email) then an InOnly is fine.
I'd be tempted to keep things fairly granular; the overhead of
extra pipeline hops should be fairly minimal, they're fairly
lightweight things. If down the road we find some common areas
that need optimisation I'm sure we can come up with solutions on
a case by case basis; for now I think keeping things easy to
reuse is a good thing.
Ok, the attachments in the messages can be > 100MB in worst case
scenarios.
That could do with some testing to make sure we can handle massive
attachments :)
Thanks for the reply and keep up the good work!
Thanks!
James
-------
http://radio.weblogs.com/0112098/