MDB and JavaMail -- a bad combination?

Discussions

EJB design: MDB and JavaMail -- a bad combination?

  1. MDB and JavaMail -- a bad combination? (3 messages)

    Is it reasonable to use JavaMail within a MDB? or is this a big mistake (for whatever reason)?

    Any thoughts/opinions will be greatly appreciated.

    Thanks,

    Paul
  2. MDB and JavaMail -- a bad combination?[ Go to top ]

    Actually I think it's a great use. For example in an on-line system where the user can make reservations on a flight/train/bus. The user shouldn't be kept waiting until the process is done so there could be used MDBs. One way to notify the user whether the booking process was successful or not is through mail. An email is sent to the user saying something like: "You have successfuly booked ..." or "There are no free places on flight no...."
  3. Yes, is a reasonable choice for a the following reasons:
    1. sending a mail could take a long time (few seconds), so is most likely to make it a 'fire and forget' operation using MDBs.
    2. sending the mail can't be done in a transactional manner. On the other hand JMS queues provide support for XA. Consider the scenario whare you have perform some database related work and sending a mail; if the database work fails for some reason, you should not send the mail. This is possible by making the mail sending and the db related work part of the same XA transaction.
    However it could be an overkill if :
    1. sending the mail is already part of an asynchronuous process (batch process, etc) and the speed is not an imperative.
    2. you don't need any fancy distributed transaction stuff
    Best regards, Mircea.
  4. MDB and JavaMail -- a bad combination?[ Go to top ]

    Thank you both for the input ... I'm (yet again) new to this stuff, and I needed a sanity check to make sure I wasn't doing something totally stupid.

    Once again, thanks!

    Paul