|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.OutputStream
com.softwareag.sagd.PMQServer.PMQOutputStream
public class PMQOutputStream
Provides a persistent message (Unit of Work or publication) as output stream.
As default, the creation of this object creats
a new Unit of Work or publication in a message queue.
After all data are written into this stream, you must close the
stream. The close()
does a commit()
, as default.
To cancel the written stream, call backout()
. In this case, the
written stream is not provided to the receiver.
main(String[])
. Following code
provides an example for usage with PMQResource
class.
PMQResource res = new PMQResource( false ); res.addBroker ( "localhost", "user", "token", "password" ); res.addService( "QUEUE/XML/TEST" ); PMQOutputStream output = res.addOutputStream( true ); output.writeFrom( System.in ); output.close(); res.cleanup();
Constructor Summary | |
---|---|
PMQOutputStream(com.softwareag.entirex.aci.BrokerService service)
Creates new output stream and creats a new UOW for service service . |
|
PMQOutputStream(PMQInputStream input)
Creates reply output stream for input stream. |
|
PMQOutputStream(com.softwareag.entirex.aci.Publication publication)
Write an output stream to publication topic. |
|
PMQOutputStream(com.softwareag.entirex.aci.UnitofWork uow)
Creates new output stream from existing Unit of Work. |
Method Summary | |
---|---|
void |
backout()
Backout and reset the written output stream. |
void |
changeBufferSize(int length)
Change the buffer size to new length. |
void |
close()
Commit the message stream if it is not disabled and UOW is created inside. |
void |
commit()
Flush the buffer and commit the UOW. |
void |
commitBoth()
This function commits 2 UOWs if the second message stream is created from the first. |
void |
disableCommitOnClose()
Disable the commit() call on close event. |
void |
flush()
Flush the current message buffer. |
long |
getLength()
Returns the number of bytes written into this stream. |
java.lang.String |
getUnitOfWorkID()
Returns the Unit of Work ID. |
com.softwareag.entirex.aci.UnitofWork |
getUOW()
Returns the UOW object. |
static void |
main(java.lang.String[] args)
Create a UOW from the standard input or a file stream and use 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 . |
void |
setContextData(java.lang.String value)
Set user context user data into the status information of created UOW. |
void |
write(byte[] b)
Write the byte array into this stream. |
void |
write(byte[] b,
int off,
int len)
Write bytes from array into this stream. |
void |
write(int b)
Write one character in this stream. |
void |
writeFrom(java.io.InputStream input)
Read the input stream and write the contents into this stream. |
void |
writeFromLFtoMessage(java.io.InputStream input)
Write the input stream to this
output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PMQOutputStream(com.softwareag.entirex.aci.BrokerService service)
service
.
service
- queue name.public PMQOutputStream(com.softwareag.entirex.aci.UnitofWork uow)
public PMQOutputStream(PMQInputStream input)
commitBoth()
must be called to commit
both UOWs. The 'commit on close' is disabled. See disableCommitOnClose()
.
input
- reply this streampublic PMQOutputStream(com.softwareag.entirex.aci.Publication publication)
Method Detail |
---|
public void disableCommitOnClose()
commit()
call on close event. Call commit()
in your application.
public void write(int b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.OutputStream
java.io.IOException
public long getLength()
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in class java.io.OutputStream
java.io.IOException
public void commit() throws java.io.IOException
java.io.IOException
public void commitBoth() throws java.io.IOException
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
code
if commit()
is callable.
java.io.IOException
public void backout() throws java.io.IOException
java.io.IOException
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.OutputStream
java.io.IOException
public void writeFrom(java.io.InputStream input) throws java.io.IOException
input
- the contents
java.io.IOException
public void writeFromLFtoMessage(java.io.InputStream input) throws java.io.IOException
input
stream to this
output stream. Line feeds inside this stream flushs
the current output and creates new message line.
The line feeds are not written.
input
- the contents
java.io.IOException
public void setContextData(java.lang.String value)
public com.softwareag.entirex.aci.UnitofWork getUOW()
public java.lang.String getUnitOfWorkID()
public void changeBufferSize(int length)
flush()
call does a reset.
length
- new size of buffer.public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |