@Override
public void start() {
if (null == this.properties) {
throw new ONSClientException("properties not set");
}
this.consumer = ONSFactory.createConsumer(this.properties);
Iterator<Entry<Subscription, MessageListener>> it = this.subscriptionTable.entrySet().iterator();
while (it.hasNext()) {
Entry<Subscription, MessageListener> next = it.next();
if (this.consumer.getClass().getCanonicalName()
.equals("com.aliyun.openservices.ons.api.impl.notify.ConsumerImpl")
&& (next.getKey() instanceof SubscriptionExt)) {
SubscriptionExt subscription = (SubscriptionExt) next.getKey();
for (Method method : this.consumer.getClass().getMethods()) {
if ("subscribeNotify".equals(method.getName())) {
try {
method.invoke(consumer, subscription.getTopic(), subscription.getExpression(),
subscription.isPersistence(), next.getValue());
}
catch (Exception e) {
throw new ONSClientException("subscribeNotify invoke exception", e);
}
break;
}
}