Meaningless Drivel is fun!*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Use of SLSB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Use of SLSB" Watch "Use of SLSB" New topic
Author

Use of SLSB

Francesco A
Greenhorn

Joined: Sep 25, 2006
Posts: 4
Hello Guys,

i'm working on SCEA part II and i'm wondering if a SLSB can be used to send Email or to open a HTTP connection with other external system.

I was looking around in the books but i didn't find anything.
Is there anyone that has this kind of experience to explain to me if i can do that?
Thanks in advace.
Frankie A.
Mat Williams
Ranch Hand

Joined: Jul 20, 2005
Posts: 215
Hi ya,

A SLSB can be used to send an email and also open a http connection to a remote host. It can not be used to list for Http connections from other hosts - this is not permitted by the spec I believe.

I am not sure that I would recommend using a SLSB to open an http connection to a remote host, but you can do it.

Mat
Francesco A
Greenhorn

Joined: Sep 25, 2006
Posts: 4
Thank you,

so if i get it correctly i should use a POJO to manage a HTTP connection.
Is this right?
Cleuton Sampaio
Ranch Hand

Joined: Nov 11, 2005
Posts: 181
Hi,

It is just a suggestion, but how about use a MessageDriven bean to send emails? It is not necessary to send emails synchronously, so, why waste resources waiting for the email server to process your request?

You post a message to a queue and then the MDB can get it and send an email message using javamail.


Cleuton Sampaio<br />Systems Architect<br />(SCEA,SCWCD,SCBCD,MCSE,MCSD)
Francesco A
Greenhorn

Joined: Sep 25, 2006
Posts: 4
Well, i could use MDB to send an email message but what if the message sent is a part of biggertransition?

In other word i should send the email during a transition and if the message sending fails the transition should fail too.
Of course when i say fail i mean that the bean can't contact the mail server for example.
Thanks
Cleuton Sampaio
Ranch Hand

Joined: Nov 11, 2005
Posts: 181
If the message sending fails, you could not confirm the message aknowledgement and it will be queued again. Later on you can try to send it again.
Babji Reddy
Ranch Hand

Joined: Jan 24, 2006
Posts: 106
Using http connecttions in SLSB is a very valid scenario. Thats what the soap calls to webservices to under the wire..
Sending emails synchronously requires high resource availability, as the ejb container sometimes might timeout if the smtp server is busy. Adjusting the timeout is also not advisable.
MDB could be a better solution. The SLSB client can poll (or PULL) the SLSB which can use JMS API to check the failure messages in the same queue.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use of SLSB
 
Similar Threads
Is it necessary to use statless sessiob bean as proxy to web service?
reg Value List Handler Pattern !!!!
EJB and OOP
Use of Stateful Session Bean for Shopping Cart
SLSB, ejbCreate() and access to EJBObject