Type
- The type of events in the associated stream.public interface Transaction<Type>
Modifier and Type | Interface and Description |
---|---|
static class |
Transaction.Status |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Drops the transaction, causing all events written to it to be deleted.
|
Transaction.Status |
checkStatus()
Gets the status of the transaction.
|
void |
commit()
Causes all messages previously written to the transaction to go into the stream contiguously.
|
void |
flush()
Blocks until all events passed to
writeEvent(String, Object) make it to durable storage. |
java.util.UUID |
getTxnId()
Returns a unique ID that can be used to identify this transaction.
|
void |
writeEvent(java.lang.String routingKey,
Type event)
Sends an event to the stream just like
EventStreamWriter.writeEvent(Type) but with the caveat that
the message will not be visible to anyone until commit() is called. |
void |
writeEvent(Type event)
Sends an event to the stream just like
EventStreamWriter.writeEvent(Type) but with the caveat that
the message will not be visible to anyone until commit() is called. |
java.util.UUID getTxnId()
void writeEvent(Type event) throws TxnFailedException
EventStreamWriter.writeEvent(Type)
but with the caveat that
the message will not be visible to anyone until commit()
is called.
A routing key will automatically be inferred from the transactionID.
So all events written this way will be fully ordered and contiguous when read.event
- The Event to write. (Null is disallowed)TxnFailedException
- The Transaction is no longer in state Transaction.Status.OPEN
void writeEvent(java.lang.String routingKey, Type event) throws TxnFailedException
EventStreamWriter.writeEvent(Type)
but with the caveat that
the message will not be visible to anyone until commit()
is called.routingKey
- The Routing Key to use for writing.event
- The Event to write. (Null is disallowed)TxnFailedException
- The Transaction is no longer in state Transaction.Status.OPEN
void flush() throws TxnFailedException
writeEvent(String, Object)
make it to durable storage.
This is only needed if the transaction is going to be serialized.TxnFailedException
- The Transaction is no longer in state Transaction.Status.OPEN
void commit() throws TxnFailedException
TxnFailedException
- The Transaction is no longer in state Transaction.Status.OPEN
void abort()
Transaction.Status checkStatus()