gnodet wrote:
>
>
> What's you exact use case for both ? It would help finding a solution.
>
>
Use case #1: In broad terms: we're trying to deploy something today,
and perhaps "slightly" change it tomorrow without having to
re-deploy. Slight changes could be, for example, overriding properties
of beans created by spring from the xbean.xml files within the service
assemblies
For this, we have a configuration endpoint that hooks up to the
container using the propertyListener, and when it notices that the
container changed to STARTED, loads a bunch of properties from a set
of tables and (re-)configures other endpoints (is this an abuse of
spring and/or servicemix? is there a better way to achieve the same?)
Use case #2: we're fetching files using ftp. Out FTPGet endpoint
accepts a simple xml message with the url to be downloaded. The files
are on external sites not under our control; we can't, for example,
remove them, or rename them; they're quite large (100Mb) and our
servicemix is clustered. We're trying to avoid downloading the same
file over and over again; we're also not interested in downloading the
same file from two nodes at the same time.
We're trying to solve this by persisting all urls successfully
downloaded to a db table; a url is added to the table as soon as the
download starts, but is removed in case of failure (could be several
hours later). I thought about having a PersistentXPathPredicate handle
the database access part, and putting an eip filter in front of the
FTPGet endpoint. The tricky bit is the "removed in case of failure"
one:
public boolean matches(MessageExchange exchange) {
step 1) use an (injected) xpath expression to find out the string to
be persisted. In this example, the string is the url to be
downloaded, but it could be anything else
step 2) use an (injected) datasource and check whether this string
is on the table. if it is, return false
step 3) add the string to the table, and add a listener (this) to
the exchange; if the exchange fails, remove the string from
the table
}
If I understand your suggestion correctly, PersistentXPathPredicate
should implement ExchangeListener, be added to the container, and do
something when the exchange fails, correct?
--
View this message in context:
http://www.nabble.com/listeners-in-container-and-MessageExchange-tf2815007s12049.html#a7859785
Sent from the ServiceMix - User mailing list archive at Nabble.com.