This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Making calls outside the container

 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to EJBs and have the following question. Can I make a socket call to a remote server from within an EJB? For example, can I make such a socket call from within the onMessage() method of a MessageDrivenBean? Or delegate to an object that can make the socket call?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can, but the specification strongly suggests you not to. I wouldn't be too afraid of doing this as long as you know that you're breaking the spec and accept the possibility of side effects.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Socket clients are acceptable but not socket servers.
The EJB architecture allows an enterprise bean instance to be a network socket client, but it does not allow it to be a network server. Allowing the instance to become a network server would conflict with the basic function of the enterprise bean-- to serve the EJB clients.
[ August 28, 2003: Message edited by: Pradeep Bhat ]
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's correct. I was too strict in my wording.
 
Benjamin Weaver
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! This is all very useful. Indeed I had a socket client in mind. As you remark, a socket server would be a redundancy.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic