Package org.symphonyoss.s2.fugue.pubsub
Class Subscription
- java.lang.Object
-
- org.symphonyoss.s2.fugue.pubsub.Subscription
-
public class Subscription extends Object
A subscription as represented in the Fugue API. This is simply a representation of the parameters of a Subscription so that it can be passed through the API. A Subscription may have an id, it has a serviceId which defaults to the current service, in which case it is represented as null in this class. It may also have an obsolete ID, which may also be null in this class. The eventual name for a Subscription is ${environmentType}-${environmentId}-${serviceId}-${subscriptionId}-${topicServiceId}-${topicId} ${subscriptionId} may be omitted, a subscription ID is only needed if a single service has multiple subscriptions to the same topic. ${topicServiceId} is the service ID of the topic owner. ${topicId} is the id of the topic- Author:
- Bruce Skingle
-
-
Constructor Summary
Constructors Constructor Description Subscription()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Collection<org.symphonyoss.s2.fugue.naming.TopicName>createObsoleteTopicNames(org.symphonyoss.s2.fugue.naming.INameFactory nameFactory)Deprecated.Collection<org.symphonyoss.s2.fugue.naming.TopicName>createTopicNames(org.symphonyoss.s2.fugue.naming.INameFactory nameFactory)Create a Collection of TopicNames for all topics for this subscription, using the given NameFactory.StringgetId()StringgetObsoleteId()SubscriptionwithId(String id)Set the optional subscriptionId.SubscriptionwithObsoleteId(String obsoleteId)Set the obsolete ID for this subscription.SubscriptionwithTopic(String topicId)Add the given locally owned Topic to the subscription.SubscriptionwithTopic(Topic topic)Add the given Topic to the subscription.
-
-
-
Method Detail
-
withId
public Subscription withId(String id)
Set the optional subscriptionId.- Parameters:
id- The subscriptionId.- Returns:
- This (fluent method)
-
withObsoleteId
public Subscription withObsoleteId(String obsoleteId)
Set the obsolete ID for this subscription. The subscription with the obsolete id will be deleted.- Parameters:
obsoleteId- The obsolete subscriptionId.- Returns:
- This (fluent method)
-
withTopic
public Subscription withTopic(Topic topic)
Add the given Topic to the subscription. It is possible to create the same subscription on multiple topics in a single operation, this method may therefore be called multiple times.- Parameters:
topic- The Topic.- Returns:
- This (fluent method)
-
withTopic
public Subscription withTopic(String topicId)
Add the given locally owned Topic to the subscription. It is possible to create the same subscription on multiple topics in a single operation, this method may therefore be called multiple times.- Parameters:
topicId- The id of the Topic, which belongs to the current service.- Returns:
- This (fluent method)
-
getId
public String getId()
- Returns:
- The topic ID (simple name).
-
getObsoleteId
public String getObsoleteId()
- Returns:
- The obsolete topic ID, if any.
-
createTopicNames
public Collection<org.symphonyoss.s2.fugue.naming.TopicName> createTopicNames(org.symphonyoss.s2.fugue.naming.INameFactory nameFactory)
Create a Collection of TopicNames for all topics for this subscription, using the given NameFactory.- Parameters:
nameFactory- The name factory to use (which knows the current environment, service etc)- Returns:
- A Collection of fully qualified topic names.
-
createObsoleteTopicNames
@Deprecated public Collection<org.symphonyoss.s2.fugue.naming.TopicName> createObsoleteTopicNames(org.symphonyoss.s2.fugue.naming.INameFactory nameFactory)
Deprecated.Create a Collection of TopicNames for all topics with obsolete names for this subscription, using the given NameFactory.- Parameters:
nameFactory- The name factory to use (which knows the current environment, service etc)- Returns:
- A Collection of fully qualified topic names.
-
-