In an Xlate you will need to have some Tcl code to query the DB.
I prefer the owner of the DB provide a Stored Procedure which will give me a return code as well as the data required rather than doing all the SQL myself. But you could do all the heavy lifting yourself.
Just make sure you allow for how you will handle loss of connectivity to the DB and the case where there is an error interacting with the DB.
Remember you are inside the Xlate with a message in flight so you need to accomodate what to do with that message should there be a DB error.
Will you be connecting/disconnecting with each message or will you attempt to connect at thread start, stay connected, and disconne4ct at thread shutdown?
You need to give consideration to how you will maintain connectivity and what you wil do when connectivity is lost so that you do not lose any messages.
As for doing the query at the outbound thread – what you outline seems plausible but you still need to know if you will connect/disconnect with each message or try to keep a persistant connection.
We have not yet done this (query DB while message is in flight) as I said – perhaps others who have can add some insight.
email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.