yeah, I think this will be the way to go since I can configure max/min instances for stateless ( http://tomee.apache.org/statelesscontainer-config.html) I think I can just create a pool of stateless instances to work as MDBs that can deal with timeout :-)
is there any way to configure a container just for these specfic stateless EJBs (so some other configuration can be used for stateless by default)? [] Leo On Tue, Apr 14, 2015 at 5:46 PM, Romain Manni-Bucau <[email protected]> wrote: > so just handle transactions yourself > > > Romain Manni-Bucau > @rmannibucau <https://twitter.com/rmannibucau> | Blog > <http://rmannibucau.wordpress.com> | Github < > https://github.com/rmannibucau> | > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber > <http://www.tomitribe.com> > > 2015-04-14 22:42 GMT+02:00 Lars-Fredrik Smedberg <[email protected]>: > > > Another option is to look at the redelivered property/redelivery count > and > > take action (write to db?) in case of redelivery.... requires you to > set a > > redelivery policy / number of retries etc > > > > /LF > > On Apr 14, 2015 10:39 PM, "Leonardo K. Shikida" <[email protected]> > wrote: > > > > > Yup, but if the MDB timeout, I need to set something in the DB, that's > > why > > > I need to treat the timeout. > > > > > > If the job to be executed timeout, then it will probably timeout for > any > > > retry, because it's caused by a poorly chosen parameter, so retries are > > not > > > important here (although increasing timeouts on each retry could be an > > > interesting option) > > > > > > [] > > > > > > Leo > > > > > > On Tue, Apr 14, 2015 at 5:27 PM, Romain Manni-Bucau < > > [email protected] > > > > > > > wrote: > > > > > > > Hmm, with MDBs you have retries since they are transactional. you can > > > even > > > > configure the redelivery policy with an exponential backoff and so on > > if > > > > really needed > > > > > > > > > > > > Romain Manni-Bucau > > > > @rmannibucau <https://twitter.com/rmannibucau> | Blog > > > > <http://rmannibucau.wordpress.com> | Github < > > > > https://github.com/rmannibucau> | > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber > > > > <http://www.tomitribe.com> > > > > > > > > 2015-04-14 22:13 GMT+02:00 Leonardo K. Shikida <[email protected]>: > > > > > > > > > Well, what I need is a pool of workers to listen to a queue and > > process > > > > > messages while they come, but I also need to properly treat them > when > > > the > > > > > JMS transaction times out. > > > > > > > > > > So I guess I can't use a MDB here right? > > > > > > > > > > What would be a good approach in this situation? > > > > > > > > > > [] > > > > > > > > > > Leo > > > > > > > > > > On Tue, Apr 14, 2015 at 4:53 PM, Romain Manni-Bucau < > > > > [email protected] > > > > > > > > > > > wrote: > > > > > > > > > > > if you want to control and be able to catch it you need to handle > > > > > yourself > > > > > > the transaction otherwise if it takes more then you'll get a > > rollback > > > > > and a > > > > > > (surely wrapped) RollbackException > > > > > > > > > > > > > > > > > > Romain Manni-Bucau > > > > > > @rmannibucau <https://twitter.com/rmannibucau> | Blog > > > > > > <http://rmannibucau.wordpress.com> | Github < > > > > > > https://github.com/rmannibucau> | > > > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber > > > > > > <http://www.tomitribe.com> > > > > > > > > > > > > 2015-04-14 21:45 GMT+02:00 Leonardo K. Shikida < > [email protected] > > >: > > > > > > > > > > > > > just checking > > > > > > > > > > > > > > I just add > > > > > > > > > > > > > > @Resource > > > > > > > private TransactionManager tx; > > > > > > > > > > > > > > > > > > > > > and in the MDB initialization I set some timeout > > > > > > > > > > > > > > @PostConstruct > > > > > > > public void initialize() { > > > > > > > try { > > > > > > > tx.setTransactionTimeout(3); > > > > > > > } catch (SystemException e) { > > > > > > > e.printStackTrace(); > > > > > > > } > > > > > > > } > > > > > > > > > > > > > > and when my onMessage() executes, if it takes more than 3 > seconds > > > to > > > > > > > complete, it throws and exception? > > > > > > > > > > > > > > and if so, how do I catch it? (or I don't?) > > > > > > > > > > > > > > [] > > > > > > > > > > > > > > Leo > > > > > > > > > > > > > > On Tue, Apr 14, 2015 at 4:20 PM, Leonardo K. Shikida < > > > > > [email protected]> > > > > > > > wrote: > > > > > > > > > > > > > > > thx! > > > > > > > > > > > > > > > > [] > > > > > > > > > > > > > > > > Leo > > > > > > > > > > > > > > > > On Tue, Apr 14, 2015 at 4:16 PM, Romain Manni-Bucau < > > > > > > > [email protected] > > > > > > > > > wrote: > > > > > > > > > > > > > > > >> Get the Transactionmanager injected (@Resource) and call > > > > > > > >> setTransactionTimeout(seconds) > > > > > > > >> > > > > > > > >> > > > > > > > >> Romain Manni-Bucau > > > > > > > >> @rmannibucau <https://twitter.com/rmannibucau> | Blog > > > > > > > >> <http://rmannibucau.wordpress.com> | Github < > > > > > > > >> https://github.com/rmannibucau> | > > > > > > > >> LinkedIn <https://www.linkedin.com/in/rmannibucau> | > > Tomitriber > > > > > > > >> <http://www.tomitribe.com> > > > > > > > >> > > > > > > > >> 2015-04-14 19:38 GMT+02:00 Leonardo K. Shikida < > > > [email protected] > > > > >: > > > > > > > >> > > > > > > > >> > Hi > > > > > > > >> > > > > > > > > >> > How do I increase the MDB onMessage() transaction timeout? > > > > > > > >> > > > > > > > > >> > [] > > > > > > > >> > > > > > > > > >> > Leo > > > > > > > >> > > > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
