use of javax.slee.resource.FireableEventType in project smscgateway by RestComm.
the class SchedulerResourceAdaptor method doInjectSms.
private boolean doInjectSms(SmsSet smsSet, boolean callFromSbb) throws NotSupportedException, SystemException, Exception, RollbackException, HeuristicMixedException, HeuristicRollbackException {
if (!callFromSbb) {
// If this call is from SBB it comes with Transaction and no need to start one
SleeTransaction sleeTx = this.sleeTransactionManager.beginSleeTransaction();
}
try {
this.doSetDestCluster(smsSet);
String eventName = null;
switch(smsSet.getType()) {
case SMS_FOR_ESME:
eventName = EVENT_SMPP_SM;
break;
case SMS_FOR_SS7:
eventName = EVENT_SS7_SM;
break;
case SMS_FOR_SIP:
eventName = EVENT_SIP_SM;
break;
}
final FireableEventType eventTypeId = this.eventIdCache.getEventId(eventName);
SmsSetEvent event = new SmsSetEvent();
event.setSmsSet(smsSet);
SchedulerActivityImpl activity = new SchedulerActivityImpl(this);
this.sleeEndpoint.startActivityTransacted(activity.getActivityHandle(), activity, ACTIVITY_FLAGS);
try {
this.sleeEndpoint.fireEventTransacted(activity.getActivityHandle(), eventTypeId, event, null, null);
} catch (Exception e) {
if (this.tracer.isSevereEnabled()) {
this.tracer.severe("Failed to fire SmsSet event Class=: " + eventTypeId.getEventClassName(), e);
}
try {
this.sleeEndpoint.endActivityTransacted(activity.getActivityHandle());
} catch (Exception ee) {
}
}
markAsInSystem(smsSet);
} catch (Exception e) {
if (!callFromSbb) {
this.sleeTransactionManager.rollback();
}
throw e;
}
if (!callFromSbb) {
// If this call is from SBB it comes with Transaction and no need to commit here
this.sleeTransactionManager.commit();
}
this.incrementActivityCount();
return true;
}
use of javax.slee.resource.FireableEventType in project jain-slee.diameter by RestComm.
the class EventIDCache method getEventId.
/**
* @param eventLookupFacility
* @param message
* @return
*/
public FireableEventType getEventId(EventLookupFacility eventLookupFacility, Message message) {
FireableEventType eventID = null;
// Error is always the same.
if (message.isError()) {
eventID = getEventId(eventLookupFacility, ERROR_ANSWER);
} else {
final int commandCode = message.getCommandCode();
final boolean isRequest = message.isRequest();
String eventName = eventNames.get(commandCode);
if (eventName != null) {
eventID = getEventId(eventLookupFacility, eventName + (isRequest ? "Request" : "Answer"));
} else {
eventID = getEventId(eventLookupFacility, EXTENSION_DIAMETER_MESSAGE);
}
}
return eventID;
}
use of javax.slee.resource.FireableEventType in project jain-slee.diameter by RestComm.
the class DiameterCCAResourceAdaptor method fireEvent.
public void fireEvent(String sessionId, Message message) {
DiameterMessage event = (DiameterMessage) createEvent(message);
FireableEventType eventId = eventIdCache.getEventId(eventLookup, message);
this.fireEvent(event, getActivityHandle(sessionId), eventId, null, true, message.isRequest());
}
use of javax.slee.resource.FireableEventType in project jain-slee.diameter by RestComm.
the class DiameterCxDxResourceAdaptor method fireEvent.
/*
* (non-Javadoc)
* @see org.mobicents.slee.resource.diameter.base.handlers.BaseSessionCreationListener#fireEvent(java.lang.String, org.jdiameter.api.Request, org.jdiameter.api.Answer)
*/
public void fireEvent(String sessionId, Message message) {
DiameterMessage event = (DiameterMessage) createEvent(message);
FireableEventType eventId = eventIdCache.getEventId(eventLookup, message);
this.fireEvent(event, getActivityHandle(sessionId), eventId, null, true, message.isRequest());
}
use of javax.slee.resource.FireableEventType in project jain-slee.diameter by RestComm.
the class EventIDCache method getEventId.
/**
* @param eventLookupFacility
* @param message
* @return
*/
public FireableEventType getEventId(EventLookupFacility eventLookupFacility, Message message) {
FireableEventType eventID = null;
// Error is always the same.
if (message.isError()) {
eventID = getEventId(eventLookupFacility, ERROR_ANSWER);
} else {
final int commandCode = message.getCommandCode();
final boolean isRequest = message.isRequest();
String eventName = eventNames.get(commandCode);
if (eventName != null) {
eventID = getEventId(eventLookupFacility, eventName + (isRequest ? "Request" : "Answer"));
} else {
eventID = getEventId(eventLookupFacility, EXTENSION_DIAMETER_MESSAGE);
}
}
return eventID;
}
Aggregations