class cMsgServerSubscribeInfo
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
(package private) cMsgClientInfo |
info
Client which created the subscription/subAndGet.
|
(package private) java.lang.String |
namespace
This refers to a cMsg subdomain's namespace in which this subscription resides.
|
(package private) java.util.HashMap<java.lang.Integer,cMsgCallbackAdapter> |
subAndGetters
This map contains all regular clients (servers do not call
subscribeAndGet but use subscribe to implement it) who have
called
cMsg.subscribeAndGet(java.lang.String, java.lang.String, int)
with this exact subject, type, and namespace. |
(package private) java.lang.String |
subject
Subject subscribed to.
|
(package private) int |
subscribed
If this is 1, the client did a subscription, else if 0 only subAndGets.
|
(package private) java.lang.String |
type
Type subscribed to.
|
Constructor and Description |
---|
cMsgServerSubscribeInfo(java.lang.String subject,
java.lang.String type,
java.lang.String namespace,
cMsgClientInfo info)
Constructor used by cMsgDomainServer object basically for storage of subject, type,
namespace and callbacks for subscribes.
|
cMsgServerSubscribeInfo(java.lang.String subject,
java.lang.String type,
java.lang.String namespace,
cMsgClientInfo info,
int id,
cMsgCallbackAdapter cb)
Constructor used by cMsgDomainServer object basically for storage of subject, type,
namespace and callbacks for subAndGets.
|
Modifier and Type | Method and Description |
---|---|
void |
addSubAndGetter(int id,
cMsgCallbackAdapter cb)
Adds an entry to a hashmap with the subscribeAndGet id as the key and the callback object
as the value.
|
void |
addSubscription()
Calling this method means this client is now subscribed to this sub/type/namespace.
|
java.util.HashMap<java.lang.Integer,cMsgCallbackAdapter> |
getSubAndGetters()
Gets the HashMap containing the subscribeAndGet id generated by the originating client
as the key (receiverSubscribeId which identifies the particular subscribeAndGet call
in question), and the value which is the callback object of that subscribeAndGet.
|
boolean |
isSubscribed()
Is the client subscribed or are there only subAndGets?
|
int |
numberOfSubscribers()
Gets the number of subscriptions a client has to a subject, type, namespace combination.
|
void |
removeSubAndGetter(int id)
Removes an entry to a hashmap with the subscribeAndGet id as the key and the callback object
as the value.
|
void |
removeSubscription()
Calling this method means this client is not subscribed to this sub/type/namespace
anymore.
|
java.lang.String subject
java.lang.String type
java.lang.String namespace
cMsgClientInfo info
int subscribed
java.util.HashMap<java.lang.Integer,cMsgCallbackAdapter> subAndGetters
cMsg.subscribeAndGet(java.lang.String, java.lang.String, int)
with this exact subject, type, and namespace. A count is
keep of how many times subscribeAndGet for a particular
client has been called. The client info object is the key
and count is the value. This is used on the server side.public cMsgServerSubscribeInfo(java.lang.String subject, java.lang.String type, java.lang.String namespace, cMsgClientInfo info)
subject
- subscription subjecttype
- subscription typenamespace
- subscription's namespaceinfo
- client information objectpublic cMsgServerSubscribeInfo(java.lang.String subject, java.lang.String type, java.lang.String namespace, cMsgClientInfo info, int id, cMsgCallbackAdapter cb)
subject
- subscription subjecttype
- subscription typenamespace
- subscription's namespaceinfo
- client information objectid
- receiverSubscribeId of subscribeAndGet requestcb
- callback of subscribeAndGetpublic void addSubscription() throws cMsgException
cMsgException
- if user tries to subscribe more than once (subscribeAndGet NOT
included)public void removeSubscription()
public boolean isSubscribed()
public java.util.HashMap<java.lang.Integer,cMsgCallbackAdapter> getSubAndGetters()
public void addSubAndGetter(int id, cMsgCallbackAdapter cb)
id
- id of subscribeAndGet callcb
- callback objectpublic void removeSubAndGetter(int id)
id
- subscribeAndGet id keypublic int numberOfSubscribers()