use of alma.acsncErrType.wrappers.AcsJEventSubscriptionFailureEx in project ACS by ACS-Community.
the class Consumer method addSubscription.
/**
* Add a subscription to a given (IDL struct) Java class. Use this method
* only when Consumer has been subclassed and processEvent overridden.
*
* @param structClass
* Type of event to subscribe to (i.e., alma.CORR.DataStruct.class).
* If <code>null</code> then all events are subscribed.
* @throws AcsJEventSubscriptionFailureEx
* Thrown if the subscription failed.
*/
public void addSubscription(Class<? extends IDLEntity> structClass) throws AcsJEventSubscriptionFailureEx {
String type = "*";
String domain = "*";
if (structClass != null) {
type = structClass.getSimpleName();
// "ALMA"
domain = getChannelDomain();
}
try {
// Subscribe to events
EventType[] added = { new EventType(domain, type) };
EventType[] removed = {};
// really subscribe to the events
m_consumerAdmin.subscription_change(added, removed);
} catch (Throwable thr) {
// org.omg.CosNotifyComm.InvalidEventType or other
AcsJEventSubscriptionFailureEx ex = new AcsJEventSubscriptionFailureEx(thr);
ex.setChannelName(m_channelName);
ex.setEventName(type);
throw ex;
}
}
Aggregations