You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Alex_ynr <su...@gmail.com> on 2007/03/21 10:50:19 UTC

Question about ServiceMix topologies

I am working on a project and I have a rough layout of what the comms part of
it should be like. The following is a very simplified example of it but I
just wanna know whether it can be done with ServiceMix (and ActiveMQ)...

I have a DB server with, say, 2 tables, an Orders table and an Order_Items
table.

I want to poll the Orders table for new orders, if there is one, get the
associated order_items, build a message containing the order details and
items and publish it to activemq. Then, on the other side, subscribe to
activemq, get the message and write a file to the filesystem containing the
information in the message in a specific format.

The actual transactions are more complicated than this and there is more
than one but that is the general idea. I just wanna know whether it can be
done or if it's not worth the effort etc.

Please note that although I can program/understand Java, it's not my primary
development language so maybe it's a silly question.

I've developed a similar system in the past but I was using a proprietary
messaging and ESB solution that supported such a topology... 
-- 
View this message in context: http://www.nabble.com/Question-about-ServiceMix-topologies-tf3439529s12049.html#a9590499
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Question about ServiceMix topologies

Posted by Alex_ynr <su...@gmail.com>.
Ok, I'll check it out.
You'll have to bear with me until I figure out the way everything works in
servicemix. 



bsnyder wrote:
> 
> On 3/22/07, Alex_ynr <su...@gmail.com> wrote:
>>
>> Ok, that sounds promising.
>>
>> Which is the base poller component to extend?
> 
> You should take a look at the
> org.apache.servicemix.file.FilePollerEndpoint in the servicemix-file
> component for an example of this. It extends the
> org.apache.servicemix.common.endpoints.PollingEndpoint for the polling
> capabilities.
> 
> You could build a single database poller component and just deploy two
> configurations of it. Then it sounds like you'd need to orchestrate
> the use of these two so that when getOrderItems messages arrive,
> they're held until the getOrders item message arrives and the two are
> transformed via XSLT into a single message.
> 

That is exactly what I had in mind. I just wasn't sure if/how it was
possible.


bsnyder wrote:
> 
>> Also, rather than a SELECT Count(*) etc. I think it should be more like
>> define the query, define the no of rows per event (do we handle 1 at a
>> time
>> even if there are more? all of them? a specific amount? etc.) and define
>> which field is the primary key and use that to poll the DB
> 
> 
> OK, so we'd need to look closer at your use case, but I think we could
> create some base functionality in the database polling component to
> make it functional and then build some additional configuration
> features on top of that.
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache Geronimo - http://geronimo.apache.org/
> Apache ActiveMQ - http://activemq.org/
> Apache ServiceMix - http://servicemix.org/
> Castor - http://castor.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/Question-about-ServiceMix-topologies-tf3439529s12049.html#a9630452
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Question about ServiceMix topologies

Posted by Bruce Snyder <br...@gmail.com>.
On 3/22/07, Alex_ynr <su...@gmail.com> wrote:
>
> Ok, that sounds promising.
>
> Which is the base poller component to extend?

You should take a look at the
org.apache.servicemix.file.FilePollerEndpoint in the servicemix-file
component for an example of this. It extends the
org.apache.servicemix.common.endpoints.PollingEndpoint for the polling
capabilities.

> Also, a generic DB component that supported the kind of behaviour I'm
> looking for would be quite hard to do since I need to get data from 2 (or
> more)tables into one transaction. Generalising this use case would lead to
> creating a way to handle this. Maybe I havent looked carefully at the
> ServiceMix documentation but I don't think it supports something like that,
> i.e. having 2 startpoints , having the data from both accessible within a
> "transaction" but only one of them responsible for the flow.
>
> For example, in the case I mentioned, I think it would look something like
> this: (btw, I'm not that familiar with ServiceMix so I hope what I'm saying
> makes sense)
>
> Similar to the file-binding example in the documentation, instead of having
> a single component as the provider (getOrders) we would have something like
> getOrders and getOrderItems.
>
> Both poll the DB continuously, but the getOrderItems "messages" stay in the
> NMR until the relevant getOrders item has reached it at which point a new
> composite message is built from those 2 sets of data (like the complete
> order as it would have  been in the file in that example) and sent to the
> placeOrders component.

You could build a single database poller component and just deploy two
configurations of it. Then it sounds like you'd need to orchestrate
the use of these two so that when getOrderItems messages arrive,
they're held until the getOrders item message arrives and the two are
transformed via XSLT into a single message.

> Also, rather than a SELECT Count(*) etc. I think it should be more like
> define the query, define the no of rows per event (do we handle 1 at a time
> even if there are more? all of them? a specific amount? etc.) and define
> which field is the primary key and use that to poll the DB

OK, so we'd need to look closer at your use case, but I think we could
create some base functionality in the database polling component to
make it functional and then build some additional configuration
features on top of that.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Castor - http://castor.org/

Re: Question about ServiceMix topologies

Posted by Alex_ynr <su...@gmail.com>.
Ok, that sounds promising.

Which is the base poller component to extend?

Also, a generic DB component that supported the kind of behaviour I'm
looking for would be quite hard to do since I need to get data from 2 (or
more)tables into one transaction. Generalising this use case would lead to
creating a way to handle this. Maybe I havent looked carefully at the
ServiceMix documentation but I don't think it supports something like that,
i.e. having 2 startpoints , having the data from both accessible within a
"transaction" but only one of them responsible for the flow.

For example, in the case I mentioned, I think it would look something like
this: (btw, I'm not that familiar with ServiceMix so I hope what I'm saying
makes sense)

Similar to the file-binding example in the documentation, instead of having
a single component as the provider (getOrders) we would have something like
getOrders and getOrderItems.

Both poll the DB continuously, but the getOrderItems "messages" stay in the
NMR until the relevant getOrders item has reached it at which point a new
composite message is built from those 2 sets of data (like the complete
order as it would have  been in the file in that example) and sent to the
placeOrders component.

Also, rather than a SELECT Count(*) etc. I think it should be more like
define the query, define the no of rows per event (do we handle 1 at a time
even if there are more? all of them? a specific amount? etc.) and define
which field is the primary key and use that to poll the DB

Any thoughts? Am I completely mistaken on what ServiceMix can do?


bsnyder wrote:
> 
> On 3/21/07, Alex_ynr <su...@gmail.com> wrote:
>>
>> I am working on a project and I have a rough layout of what the comms
>> part of
>> it should be like. The following is a very simplified example of it but I
>> just wanna know whether it can be done with ServiceMix (and ActiveMQ)...
>>
>> I have a DB server with, say, 2 tables, an Orders table and an
>> Order_Items
>> table.
>>
>> I want to poll the Orders table for new orders, if there is one, get the
>> associated order_items, build a message containing the order details and
>> items and publish it to activemq. Then, on the other side, subscribe to
>> activemq, get the message and write a file to the filesystem containing
>> the
>> information in the message in a specific format.
>>
>> The actual transactions are more complicated than this and there is more
>> than one but that is the general idea. I just wanna know whether it can
>> be
>> done or if it's not worth the effort etc.
>>
>> Please note that although I can program/understand Java, it's not my
>> primary
>> development language so maybe it's a silly question.
>>
>> I've developed a similar system in the past but I was using a proprietary
>> messaging and ESB solution that supported such a topology...
> 
> Yes, ServiceMix can handle this topology. The only pieces that it
> doesn't currently offer are a database component and a database
> poller.
> 
> Creating a database poller should be fairly simple because ServiceMix
> already has a base poller and we can just extend it. I'm thinking that
> it would perform a select count(*) from <table> and if the result
> comes back greater than 0, then the rest of the flow is triggered.
> 
> Creating a database component that is generically usable would be a
> bit more work, but this is certainly achievable.
> 
> We can help you create both of these if you can work with us on the
> use case. I've wanted to create each of these for some time now, but I
> just haven't had a chance.
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache Geronimo - http://geronimo.apache.org/
> Apache ActiveMQ - http://activemq.org/
> Apache ServiceMix - http://servicemix.org/
> Castor - http://castor.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/Question-about-ServiceMix-topologies-tf3439529s12049.html#a9611190
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Question about ServiceMix topologies

Posted by Bruce Snyder <br...@gmail.com>.
On 3/21/07, Alex_ynr <su...@gmail.com> wrote:
>
> I am working on a project and I have a rough layout of what the comms part of
> it should be like. The following is a very simplified example of it but I
> just wanna know whether it can be done with ServiceMix (and ActiveMQ)...
>
> I have a DB server with, say, 2 tables, an Orders table and an Order_Items
> table.
>
> I want to poll the Orders table for new orders, if there is one, get the
> associated order_items, build a message containing the order details and
> items and publish it to activemq. Then, on the other side, subscribe to
> activemq, get the message and write a file to the filesystem containing the
> information in the message in a specific format.
>
> The actual transactions are more complicated than this and there is more
> than one but that is the general idea. I just wanna know whether it can be
> done or if it's not worth the effort etc.
>
> Please note that although I can program/understand Java, it's not my primary
> development language so maybe it's a silly question.
>
> I've developed a similar system in the past but I was using a proprietary
> messaging and ESB solution that supported such a topology...

Yes, ServiceMix can handle this topology. The only pieces that it
doesn't currently offer are a database component and a database
poller.

Creating a database poller should be fairly simple because ServiceMix
already has a base poller and we can just extend it. I'm thinking that
it would perform a select count(*) from <table> and if the result
comes back greater than 0, then the rest of the flow is triggered.

Creating a database component that is generically usable would be a
bit more work, but this is certainly achievable.

We can help you create both of these if you can work with us on the
use case. I've wanted to create each of these for some time now, but I
just haven't had a chance.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache Geronimo - http://geronimo.apache.org/
Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Castor - http://castor.org/