Skip to main content

Events fired from EJB not received in SBB

8 replies [Last post]
czoth
Offline
Joined: 2006-03-24

Hello everybody,

though I spent 2 days reading through this excellent forum, I was not able to find an appropriate solution/idea for my problem - so I decided to post a new thread hoping the topic did not come up already.

As I am quite new to the JAIN SLEE stuff it might be possible that I got some things wrong, so please don't be too serious with the way I explain my problem:

I wrote a RA receiving Diameter tickets and sending appropriate Events to a SBB.
This is working fine - the SBB catches the events, processes them and responds via the ResourceAdaptorSbbInterface.

Furthermore I wrote an EJB with a billing-interface whose methods are called by the SBB. For getting an answer from this method I understood that there are 2 ways:

- the "sychronous" way of calling a method with a return value - means the SBB is "blocked" until a response is sent
- the "asynchronous" way of calling a void method - means the EJB has to fire an event (containing the response) to the SBB whose instance meanwhile can be used elsewise

I implemented the "synchronous" way and it worked, but the "asynchronous" way I can't get running. The events are fired correctly, but the SBB does not catch them.

I used the example from JAIN SLEE 1.1 Specification Appendix F.

As SleeConnectionFactory I used MobicentsConnectionFactory - perhaps this is already the problem...?

Do I have to write my own SleeConnectionFactory/SleeConnection implementation?

- If NO: How does SLEE know to which ActivityContext the event from the EJB has to be fired to (because with ExternalActivityHandle the event is fired on a newly created null activity)

- If YES: Is there any Tutorial/Example-Implementation for that?

But maybe I'm completely wrong with my thinking and the EJB fire-event thing is not meant for such purposes...?

Tankx a lot for any help!

regards

carsten

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
eduardomartins
Offline
Joined: 2005-10-10

As I said only ExternalActivityHandle's can be used in the slee connection side, so no way to fire the event on the diameter activity (otherwise you wouldn't need two initial events).

In JAIN SLEE 1.0 the right way to retreive a specific ActivityContexInterface attached is using sbbContext.getActivities() in a loop, usually checking .getActivity() class instance to find the one wanted, in JAIN SLEE 1.1 it will be safe (and recommended) to store ActivityContexInterfaces in CMPs.

czoth
Offline
Joined: 2006-03-24

It works!

Thank you very much for your fast, excellent and correct! replies!

Checking the sbbContext.getActivities() helped.

It was also necessary to use an InitialEventSelector, elsewise the events were all processed by only one! SBB (what seems quite reasonable if you think about it for a while, because all events are fired on the same Address).

So I wrote an initialEventSelector method (referenced by each event with initial-event="True" in addition to the variable="Address" param) setting the sessionID of the diameter message as CustomName in the InitialEventSelector object and now everything is fine.

Regarding the CMP approach - do you mean to reference the current aci by e.g. a Diameter SessionID in a CMP?
Sorry, I'm not yet familiar with CMP...

Message was edited by: czoth

Message was edited by: czoth

fram
Offline
Joined: 2004-05-13

I agree with you that is very very close to a workaround but it's a standard well define mechanism that wou can safetly use in your apps. Another example of using this mechanism is a SLEE service that receive SIP events on different activity context (e.g. SIp Transactions) but you want them to be processed by the same service instance.

Everytime the Slee receive an intial event for a given service, the convergence name computation process is started. Initial event selection variable and methods are the tool you have to control the convergence name computation mechanism.
Once the SLEE creates a new instance of the SBB Entity this entity is automatically attached to the activity context of the initial event and it's identify by the container with the convergence name.

If at a later time the SLEE receive another initial event for that service, the convergence name computation starts again according to the sbb descriptor and if an SBB Entity already exist with the given convergence name, the container is not going to create a new SBB Entity instance but will attach the existing one to the Activity Context, on which the event has been fire.

Francesco

czoth
Offline
Joined: 2006-03-24

Hey,

thanks for the "Address" hint - that worked so far that the event reaches the SBB.

But now there is another problem - I do get a NullActivity in the SBB, but I need my own DiameterActivity that I had previously (e.g. when firing events from the RA) for changing the State Machine etc.

How do I get back my DiameterActivity?

The EJB fires an event on a newly created NullActivity - is there any way to fire on my DiameterActivity?

fram
Offline
Joined: 2004-05-13

How are your diameter activities identified ?

You need to store the diameterActivityID in a CMP field of your SBB Entity and then provide a method in the Resource Adaptor sbb interface to retrieve at a later time your activity inside the RA. If the SBB Entity on which you receive the event is a different instance you need to put the diameterActivityID inside the event.

Once you have this method inside the RA sbb interface. You can have an SBB inside the SLEE that receives the events and use the diameterActivityID to post the event on the corresponding ActivityContext. In order to implement this option you need the diameter RA to provide an ActivityContextInterfaceFactory to retrieve the ActivityContextInterface from the diameter activity object. Once you have the ActivityContextInterface related to the diameter activity fire the event on it.

Francesco

fram
Offline
Joined: 2004-05-13

One possible solution is to declare the event fired by the SleeConnection as initial, but you need to ensure that the initial event select mechanism returns the same convergence name of the SBB Entity who called the EJB. This will auto-attach the existing SBB Entity to the External Activity Context.

What do you use as initial-event-select variable or method?

Francesco

czoth
Offline
Joined: 2006-03-24

Hey,

thanks for your reply,

but isn't this kind of "workaround" - to declare an event "initial" though it actually isn't...

...besides the SBB Entity does already exist - so what would happen if the event is fired?

If I understood you right, in case a SBB entity already exists - no matter what ActivityContext it is attached to - the event will be processed by this entity?

I already tried that, but it did not work...

As initial-event-select I use variable="ActivityContext"

eduardomartins
Offline
Joined: 2005-10-10

You have no way to attach the SBB to an ExternalActivityHandle activity so you have no other choice than do as Francesco said, and opt for the two initial events setup.

You have two choices of implementation:

1) Define a unique Address in the RA for each event that is fired, and have the sbb pass that Address to the ejb to be used when firing the ejb event. Both events must be declared as initial by the Service's SBB using in the descriptor:

SLEE will generate the same convergence name for both events, thus being the same sbb entity.

2) Declare both events as initial using a initialEventSelector method in the SBB, then for both events come up with the same custom name in the initialEventSelector method (using common info in the two events), making sure no other variable of the convergence name is selected in the sbb descriptor.

Another alternative is to consider that the two events are initial but don't need to be the same sbb entity, which requires the ejb event to deliver all instance data needed to send back a reply via diameter.