• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Why MDB is "loosely coupled" than Asynchronous Bean ?

 
Ranch Hand
Posts: 51
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

It is said in "EJB 3 in Action (2nd Edition) by "Debu Panda et.al" that if you want loosely couple and reliable functionality choose message driven bean instead of asynchronous bean. The reason for the tight coupling of asynchronous bean is given as "the client has direct reference" to asynchounous bean.

In general MDB looks more tightly coupled to me than Asynch Bean as if JNDI name of connection factory is changed we have to update both client and MDB whereas Asyn Bean doesn't look like tightly coupled.


Why is it that Asynchronous bean is considered tightly coupled ?
 
author & internet detective
Posts: 39997
807
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Haven't used an Async Bean, but my understanding is that you need to have the implementation. Whereas with an MDB, you only need to have the remote interface(s) rather than the implementation class. This means if there is a change in implementation, an MDB's client wouldn't need to be updated, but an async bean's would.
 
Enthuware Software Support
Posts: 4428
41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:I Haven't used an Async Bean, but my understanding is that you need to have the implementation. Whereas with an MDB, you only need to have the remote interface(s) rather than the implementation class. This means if there is a change in implementation, an MDB's client wouldn't need to be updated, but an async bean's would.


Although a bean class is not required to implement any interface if it is accessed only locally, you don't need implementation class for any bean in general (from the client perspective). You need just the interface. In case of async bean, the client is still tied to the interface.

For MDB, there is no interface. The client just needs the destination (queue or topic) address. This allows you replace your MDB without any impact on the client code. Hence, more loosely coupled than async bean.
 
Jeanne Boyarsky
author & internet detective
Posts: 39997
807
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh! I read MDB as remote EJB. (I don't know why). Ignore my post.

 
Kaxhif Khan
Ranch Hand
Posts: 51
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne Boyarsky and Paul Anilprem
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic