|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
com.softwareag.sagd.PMQServer.PMQInputStream
public class PMQInputStream
Read a UOW or publication as input stream.
Use themain(String[])
method to receive
message objects and prints the contents to standard input or
file system.
The following example uses the PMQResource
interface
as server to print out the stream.
PMQResource res = new PMQResource( false ); res.addBroker ( "localhost", "user", "token", "password" ); res.addService( "QUEUE/XML/TEST" ); PMQInputStream input = res.addInputStream( true );; input.readTo( System.out ); input.close(); res.cleanup();
Constructor Summary | |
---|---|
PMQInputStream(com.softwareag.entirex.aci.BrokerMessage message)
Create input stream from given message |
|
PMQInputStream(com.softwareag.entirex.aci.BrokerService service)
Try to receive a message from BrokerService service . |
|
PMQInputStream(com.softwareag.entirex.aci.BrokerService service,
boolean doReceiveOld)
Try to receive a message from BrokerService service . |
|
PMQInputStream(com.softwareag.entirex.aci.Publication publication)
Create input stream from given publication. |
|
PMQInputStream(com.softwareag.entirex.aci.UnitofWork uow)
Creat input stream from given UOW. |
Method Summary | |
---|---|
void |
backout()
Backout and reset the message stream. |
void |
close()
Close the message stream if auto commit is not disabled. |
void |
commit()
Commit and close the current message stream. |
void |
disableCommitOnClose()
Disable auto commit on close() . |
java.lang.String |
getClientUserID()
Returns the user ID of message creator. |
java.lang.String |
getContextData()
Returns the context data as string. |
java.lang.String |
getUnitOfWorkID()
Returns the Unit of Work ID. |
com.softwareag.entirex.aci.UnitofWork |
getUOW()
Returns the current UOW object. |
static void |
main(java.lang.String[] args)
Reads a message as stream from the command line. |
boolean |
prepareCommit()
Prepares and asks the current status of Unit of Work to commit this stream without errors. |
protected boolean |
prepareCommit(long activityTime)
Call only prepareCommit() when the last Broker call was later then activityTime . |
int |
read()
Read and return one character from this stream. |
byte[] |
readLine()
Reads one message line. |
void |
readTo(java.io.OutputStream outputStream)
Read this stream and write the contents to outputStream . |
void |
setFilter(PMQFilterInterface filter)
Set filter to work only with accepted UOWs. |
static void |
setWaitTime(java.lang.String value)
Set the wait time for waiting new created conversations. |
Methods inherited from class java.io.InputStream |
---|
available, mark, markSupported, read, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PMQInputStream(com.softwareag.entirex.aci.UnitofWork uow) throws com.softwareag.entirex.aci.BrokerException
com.softwareag.entirex.aci.BrokerException
public PMQInputStream(com.softwareag.entirex.aci.BrokerMessage message)
public PMQInputStream(com.softwareag.entirex.aci.Publication publication)
public PMQInputStream(com.softwareag.entirex.aci.BrokerService service) throws com.softwareag.entirex.aci.BrokerException
service
.
The message queue is searched for old message, created
with same user ID and token.
com.softwareag.entirex.aci.BrokerException
public PMQInputStream(com.softwareag.entirex.aci.BrokerService service, boolean doReceiveOld) throws com.softwareag.entirex.aci.BrokerException
service
.
setWaitTime(String)
defines the max. wait time for new created messages.
service
- read from this queuedoReceiveOld
- true
search for OLD messages, false
seach messages with NEW conversation state.
com.softwareag.entirex.aci.BrokerException
Method Detail |
---|
public static void setWaitTime(java.lang.String value)
pmq.resource.waittime
.
value
- Wait time as string. The default is 1S
.public void disableCommitOnClose()
close()
. Call explicit
commit()
.
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public byte[] readLine() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.InputStream
java.io.IOException
public boolean prepareCommit() throws java.io.IOException
java.io.IOException
- if next commit()
is not possibleprotected boolean prepareCommit(long activityTime) throws java.io.IOException
prepareCommit()
when the last Broker call was later then activityTime
.
For example, the last Broker was 1 second ago. With activityTime
of 2 seconds, prepareCommit()
is not called.
activityTime
- in milliseconds
java.io.IOException
public void commit() throws java.io.IOException
java.io.IOException
public void backout() throws java.io.IOException
java.io.IOException
public void readTo(java.io.OutputStream outputStream) throws java.io.IOException
outputStream
.
No stream is closed.
outputStream
- target stream
java.io.IOException
public void setFilter(PMQFilterInterface filter) throws java.lang.Exception, com.softwareag.entirex.aci.BrokerException
java.lang.Exception
com.softwareag.entirex.aci.BrokerException
public java.lang.String getContextData()
public java.lang.String getClientUserID()
null
if not available.public com.softwareag.entirex.aci.UnitofWork getUOW()
public java.lang.String getUnitOfWorkID()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |