cancel
Showing results for 
Search instead for 
Did you mean: 

Can one MDB extend other MDB in SAP Web AS

Former Member
0 Kudos

Hi

I am migrating a application from weblogic to SAP web AS sp 15 .Is it possible to extend one Message Driven bean from other Message driven bean

regards

rajesh kr

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Rajesh,

No it's not possible. Inheritance for EJB-s is not part of J2EE 1.3 which is the implemented J2EE version.

HTH

Peter

Former Member
0 Kudos

Hi peter

Thanks so much for your reply .

It works fine in weblogic 8.1, as we have one MDB Which extends other MDB. Will it cause any problem in SAP WEb AS though its subscribed to 2 different topics ?

regards

rajesh kr

Former Member
0 Kudos

Hi Rajesh,

Sorry, One MDB can be subscribed only to one topic.

Btw, do you have any link, documentation about those MDB extensions and two topics per MDB in weblogic. I am interested.

HTH

Peter

Former Member
0 Kudos

Hi peter

Its one topic per MDB . The only thing is that MDB2 Extends MDB1 which listens to other topic. MDB2 does not have any code ,it just extends MDB1.

Unfortunately Weblogic does not provide any documentation on this .

regards

rajesh kr

Former Member
0 Kudos

Hi Rajesh,

Such functionality is not standard and part of the specification. There is no such possibility in SAP WAS.

However it should be easy to achieve the same effect. Simply move the message processing code into a method "myOnMessage(Message m) and then invoke it from the two MDB-s for the two topics.

MDB1 {

public void onMessage(Message m){

myClass.myOnMesage(m);

}

}

HTH

Peter

Former Member
0 Kudos

Hi peter

Thanks for your reply

We have a onMessage() method in MDB1 only . and no methods at all in MDB2. Will this implementation still not work in SAP WEB AS?

Regards

rajesh kr

Former Member
0 Kudos

Hi Rajesh,

Here is in more details what I meant. Just move the existing code in onMessage() from MDB1 to a new class - MyLogic or whatever. Pass it whatever parameters you are using - the message probably, or additionally javax.ejb.EJBContext if you are using some more advanced functionality.

Then call from your two MDB-s this new java method.

MDB1 {

public void onMessage(Message m) {

MyLogic myLogic = new MyLogic();

myLogic.onMessage(m);

}

}

MDB2 {

public void onMessage(Message m) {

MyLogic myLogic = new MyLogic();

myLogic.onMessage(m);

}

}

HTH

Peter

Former Member
0 Kudos

Hi Peter

Thanks again for your reply

I had understood the implementation you had told me ,but I wanted to check with you whether the implementation i had told in my previous message will it work for WEB AS ?

regards

rajesh kr

Former Member
0 Kudos

Hi Rajesh,

No - such functionality (linking two MDB-s somehow together so that the second MDB reuses automatically the code from the first) will NOT work in WEB AS. There is no way to achieve it without code change.

HTH

Peter

Answers (0)