本文整理汇总了Java中org.wso2.carbon.event.core.subscription.Subscription.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Subscription.getId方法的具体用法?Java Subscription.getId怎么用?Java Subscription.getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.event.core.subscription.Subscription
的用法示例。
在下文中一共展示了Subscription.getId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renewSubscription
import org.wso2.carbon.event.core.subscription.Subscription; //导入方法依赖的package包/类
public void renewSubscription(Subscription subscription) throws EventBrokerException {
String topicName = getTopicName(subscription.getTopicName());
Map<String, Subscription> subscriptionsMap = this.topicSubscriptionMap.get(topicName);
if (subscriptionsMap == null){
throw new EventBrokerException("There is no subscriptions with topic " + topicName);
}
Subscription existingSubscription = subscriptionsMap.get(subscription.getId());
if (existingSubscription == null){
throw new EventBrokerException("There is no subscription with subscription id " + subscription.getId());
}
existingSubscription.setExpires(subscription.getExpires());
existingSubscription.setProperties(subscription.getProperties());
}
示例2: testCarbonSubscriptionToSOAP12Envelope
import org.wso2.carbon.event.core.subscription.Subscription; //导入方法依赖的package包/类
public void testCarbonSubscriptionToSOAP12Envelope() throws Exception {
Subscription subscription = new Subscription();
subscription.setId("uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa");
subscription.setEventSinkURL("http://www.example.org/oceanwatch/SubscriptionManager");
String id = subscription.getId();
MessageContext mc = CommandBuilderTestUtils.getMCWithSOAP12Envelope();
SubscribeCommandBuilder builder = new SubscribeCommandBuilder(mc);
OMElement payload = builder.fromSubscription(subscription);
String expectPayload = RESPONSE_PAYLOAD_SOAP12.replace(
"uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa", id);
assertEquals("Invalid response for the get status request", expectPayload,
payload.toString());
}
示例3: testCarbonSubscriptionToSOAP11Envelope
import org.wso2.carbon.event.core.subscription.Subscription; //导入方法依赖的package包/类
public void testCarbonSubscriptionToSOAP11Envelope() throws Exception {
Subscription subscription = new Subscription();
subscription.setId("uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa");
subscription.setEventSinkURL("http://www.example.org/oceanwatch/SubscriptionManager");
String id = subscription.getId();
MessageContext mc = CommandBuilderTestUtils.getMCWithSOAP11Envelope();
SubscribeCommandBuilder builder = new SubscribeCommandBuilder(mc);
OMElement payload = builder.fromSubscription(subscription);
String expectPayload = RESPONSE_PAYLOAD_SOAP11.replace(
"uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa", id);
assertEquals("Invalid response for the get status request", expectPayload,
payload.toString());
}
示例4: renewSubscription
import org.wso2.carbon.event.core.subscription.Subscription; //导入方法依赖的package包/类
public void renewSubscription(Subscription subscription) throws EventBrokerException {
String topicName = getTopicName(subscription.getTopicName());
SubscriptionContainer subscriptionContainer = getTopicSubscriptionCache().get(topicName);
if (subscriptionContainer == null){
throw new EventBrokerException("There is no subscriptions with topic " + topicName);
}
Subscription existingSubscription = subscriptionContainer.getSubscriptionsCache().get(subscription.getId());
if (existingSubscription == null){
throw new EventBrokerException("There is no subscription with subscription id " + subscription.getId());
}
existingSubscription.setExpires(subscription.getExpires());
existingSubscription.setProperties(subscription.getProperties());
String val = subscription.getProperties().get("notVerfied");
if(val == null) {
getSubscriptionIDTopicNameCache().put(subscription.getId()+"-notVerfied", "false");
} else {
if("true".equalsIgnoreCase(val)) {
getSubscriptionIDTopicNameCache().put(subscription.getId()+"-notVerfied", "true");
} else {
getSubscriptionIDTopicNameCache().put(subscription.getId()+"-notVerfied", "false");
}
}
}
示例5: subscribe
import org.wso2.carbon.event.core.subscription.Subscription; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public String subscribe(Subscription subscription)
throws EventBrokerException {
//if there is a subscription with the same topic and event sink url then
//we think it is the same subscription.
Subscription existingSubscription = getExistingNonExpiredSubscription(subscription);
if (existingSubscription != null) {
return existingSubscription.getId();
}
if (EventBrokerHolder.getInstance().getTenantDomain() != null) {
subscription.setTenantDomain(EventBrokerHolder.getInstance().getTenantDomain());
subscription.setTenantId(EventBrokerHolder.getInstance().getTenantId());
}
// generates an id for the subscription
subscription.setId(UIDGenerator.generateUID());
this.topicManager.addTopic(subscription.getTopicName());
this.deliveryManager.subscribe(subscription);
if (subscription.getEventDispatcherName() != null) {
// we persists a subscription only if it has a event dispatcher
// name. the subscriptions with only an event dispatcher is not persisted.
this.subscriptionManager.addSubscription(subscription);
} else {
if (subscription.getEventDispatcher() == null) {
throw new EventBrokerException(" subscription url, event " +
"dispatcher name and event dispatcher is null");
}
}
return subscription.getId();
}