|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softwareag.entirex.aci.Publication
public class Publication
This class is the Java ACI for the Broker Publish & Subscribe ACI.
The class holds a publication of the Broker, published or received. The
publication can hold one or more messages. The messages are
BrokerMessage
objects. The publication is closed with
commit
and discarded with backout
.
Field Summary | |
---|---|
static java.lang.String |
MSG_FIRST
A publication status. |
static java.lang.String |
MSG_LAST
A publication status. |
static java.lang.String |
MSG_MIDDLE
A publication status. |
static java.lang.String |
MSG_ONLY
A publication status. |
Constructor Summary | |
---|---|
Publication(Broker broker,
java.lang.String topicName)
Create a publication with a given Broker and a topic name. |
Method Summary | |
---|---|
void |
backout()
Backs out this publication. |
void |
commit()
Commits this publication. |
java.lang.String |
getPublicationId()
Gets the publication ID. |
java.lang.String |
getPublicationStatus()
Gets the status of the publication. |
int |
getReceiveLength()
Gets the recieve length. |
java.lang.String |
getUserStatus()
Gets the user status field of this publication. |
java.lang.String |
last()
Gets the status of the last publication of this user. |
void |
publish(BrokerMessage message)
Publishes a message within the topic. |
java.lang.String |
query()
Gets the status of the publication given by the publication id. |
BrokerMessage |
receive()
Receive a message within the topic with no wait time. |
BrokerMessage |
receive(java.lang.String wait)
Receive a message within the topic with a wait time. |
void |
setPublicationId(java.lang.String publicationId)
Sets the publication ID. |
void |
setReceiveLength(int receiveLength)
Sets the recieve length. |
void |
setUserStatus(java.lang.String userStatus)
Sets the user status field of this publication. |
void |
subscribe(boolean durable)
Subscribes to the topic of this publication. |
void |
unsubscribe()
Unsubscribes this subscriber from the topic. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String MSG_ONLY
receive
are
allowed.
public static final java.lang.String MSG_LAST
receive
are
allowed.
public static final java.lang.String MSG_FIRST
public static final java.lang.String MSG_MIDDLE
Constructor Detail |
---|
public Publication(Broker broker, java.lang.String topicName)
Broker
and a topic name.
broker
- the Broker
. Must not equal null
.topicName
- the name of the topic.
java.lang.IllegalArgumentException
- if the Broker
is
null
.Method Detail |
---|
public void publish(BrokerMessage message) throws BrokerException
message
- the BrokerMessage
to publish.
BrokerException
- if the Broker
returns an error or
the publication ID is corrupt.
java.lang.IllegalArgumentException
- if the message is null
.public BrokerMessage receive() throws BrokerException
getPublicationStatus
. If the status is
MSG_ONLY
or MSG_LAST
, commit
or
backout
the publication and create a new
Publication
object before receiving the next message.
The PublicationListen
does this checking and always
commits the publication.
BrokerException
- if the Broker
returns an error or
the publication ID is corrupt.getPublicationStatus()
,
PublicationListener
,
receive(java.lang.String)
public BrokerMessage receive(java.lang.String wait) throws BrokerException
getPublicationStatus
. If the status is
MSG_ONLY
or MSG_LAST
, commit
or
backout
the publication and create a new
Publication
object before receiving the next message.
The PublicationListen
does this checking and always
commits the publication.
wait
- the timeout period, how long to wait for
a message, measured in seconds/minutes/hours (depending on the
trailing S/M/H character). When null
or "NO" is specified,
the operation is non-blocked. If no message is available, a
BrokerException
with errorclass=74 and errorcode=74 is
thrown.
BrokerException
- if the Broker returns an error or
the publication ID is corrupt or a wait time out occurs.getPublicationStatus()
,
PublicationListener
,
receive()
public void subscribe(boolean durable) throws BrokerException
Broker
object as a subscriber name.
Only the subscriber uses this method.
durable
- if true
, the subscription is stored in the
Broker and it is valid until unsubscribe
, even if this
subscriber is not active.
BrokerException
- if the Broker
returns an error.public void unsubscribe() throws BrokerException
logon
call.
Only the subscriber uses this method.
BrokerException
- if the Broker
returns an error.public void commit() throws BrokerException
If a publisher commits a publication, this is visible for the subscribers and they can receive the publication. Once a publisher commits a publication, no more messages can be added.
If the subscriber commits a publication, it finished receiving messages of this publication. Afterwards, this subscriber cannot receive any unread message from this publication.
BrokerException
- if the Broker
returns an error.public void backout() throws BrokerException
If a publisher backs out a publication,
all messages in this publication are deleted. Create a new
Publication
object before publishing new messages.
If a subscriber backs out a publication it can start to recieve the first and all following messages again.
BrokerException
- if the Broker
returns an error.public java.lang.String last() throws BrokerException
BrokerException
- if the Broker
returns an error.public java.lang.String getPublicationStatus()
MSG_ONLY
,
MSG_FIRST
,
MSG_MIDDLE
,
MSG_LAST
public java.lang.String query() throws BrokerException
BrokerException
- if the Broker
returns an error.public void setUserStatus(java.lang.String userStatus) throws BrokerException
userStatus
- the user status.
BrokerException
- if the Broker
returns an error.public java.lang.String getUserStatus()
public int getReceiveLength()
public void setReceiveLength(int receiveLength)
receiveLength
- the receive length given in bytes.public java.lang.String getPublicationId()
public void setPublicationId(java.lang.String publicationId)
publish
or receive
.
publicationId
- the publication ID.
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |