Package com.swiftmq.impl.streams
Class Stream
java.lang.Object
com.swiftmq.impl.streams.Stream
Stream is the entry point for SwiftMQ Streams.
It is passed as a global variable "stream" to Stream Scripts and is used to create and
access Stream resources such as Memories, Timers, Inputs etc.
- Author:
- IIT Software GmbH, Muenster/Germany, (c) 2016, All Rights Reserved
-
Field Summary
-
Constructor Summary
ConstructorDescriptionStream
(StreamContext ctx, String domainName, String packageName, String name, int restartCount) Internal use only -
Method Summary
Modifier and TypeMethodDescriptionInternal use onlyaddJDBCLookup
(String name, JDBCLookup jdbcLookup) Internal use onlyaddMailServer
(String name, MailServer mailServer) Internal use onlyInternal use onlyaddMemoryGroup
(String name, MemoryGroup memoryGroup) Internal use onlyInternal use onlyaddTempQueue
(String name, TempQueue tempQueue) Internal use onlyInternal use onlyWraps an async callback with a proxy that implements the interface given by the "interfaceClassName" and runs the callback on the Stream's event queue.cli()
Returns the stream's CLIvoid
close()
Internal use onlyvoid
collect
(long interval) Internal use onlycreate()
Returns a stream builder to create stream resourcescurrent()
Returns the currently processed Message.Sets/overwrites the currently processed Message.void
Internal use onlyReturns the Domain Name of this Stream.executeCallback
(FunctionCallback functionCallback, Object context) Executes a function callback in the Stream's event queue.void
Internal use onlyvoid
Internal use onlyvoid
Internal use onlyvoid
Internal use onlyReturns the fully qualified Stream name: domain.package.nameInput[]
Internal use onlyInternal use onlyInternal use onlyMemory[]
Internal use onlyInternal use onlyOutput[]
Internal use onlyInternal useInternal use onlyTimer[]
Internal use onlyReturns the working directory of the routerReturns the Input for this TempQueue.Returns the Input with the given name.jdbcLookup
(String name) Returns the JDBCLookup with the given name.Returns the last exception occurred on the streamReturns the formatted stack trace of the last exception occurred on the streamlog()
Returns the stream's LogDestination
lookupJNDI
(String name) Returns a Destination registered in JNDI under this name.mailserver
(String name) Returns the MailServer with the given name.Returns the Memory with the given name.memoryGroup
(String name) Returns the MemoryGroup with the given name.name()
Returns the name of this streamonException
(ExceptionCallback runnable) Sets the onException callback.Sets the onMessage callback.Sets the onStart callback.Sets the onStop callback.Returns the Output with the given name.Returns the Package Name of this StreamCloses all Outputs that were not used between the last and this call to this method.QueueImpl
Factory method to return a new QueueImpl (address)removeInput
(Input input) Internal use onlyremoveJDBCLookup
(String name) Internal use onlyremoveMailServer
(String name) Internal use onlyvoid
removeMemory
(Memory memory) Internal use onlyvoid
removeMemoryGroup
(MemoryGroup memoryGroup) Internal use onlyremoveOutput
(String name) Internal use onlyremoveTempQueue
(TempQueue tempQueue) Internal use onlyremoveTimer
(Timer timer) Internal use onlyint
Returns the restart count of this streamReturns the name of the local Router.void
start()
Internal use onlyReturns the Stream's State Memory that is used by MemoryGroups to store their associated Memories.Returns the TempQueue with the given name.Returns the Timer with the given name.TopicImpl
Factory method to return a new TopicImpl (address)toString()
-
Field Details
-
closed
public boolean closed
-
-
Constructor Details
-
Stream
public Stream(StreamContext ctx, String domainName, String packageName, String name, int restartCount) Internal use only
-
-
Method Details
-
getStreamCtx
Internal use- Returns:
- stream context
-
routerName
Returns the name of the local Router.- Returns:
- routerName
-
domainName
Returns the Domain Name of this Stream.- Returns:
- domain name
-
packageName
Returns the Package Name of this Stream- Returns:
- package name
-
name
Returns the name of this stream- Returns:
- name
-
fullyQualifiedName
Returns the fully qualified Stream name: domain.package.name- Returns:
- fully qualified name
-
restartCount
public int restartCount()Returns the restart count of this stream- Returns:
- restart count
-
log
Returns the stream's Log- Returns:
- Log
-
cli
Returns the stream's CLI- Returns:
- CLI
-
getWorkingDirectory
Returns the working directory of the router- Returns:
-
stateMemory
Returns the Stream's State Memory that is used by MemoryGroups to store their associated Memories.- Returns:
- stateMemory
-
addMemory
Internal use only -
addMemoryGroup
Internal use only -
removeMemory
Internal use only -
removeMemoryGroup
Internal use only -
addTimer
Internal use only -
removeTimer
Internal use only -
addInput
Internal use only- Throws:
Exception
-
removeInput
Internal use only -
addOutput
Internal use only -
removeOutput
Internal use only -
addMailServer
Internal use only -
removeMailServer
Internal use only -
addJDBCLookup
Internal use only -
removeJDBCLookup
Internal use only -
addTempQueue
Internal use only -
removeTempQueue
Internal use only -
getTimers
Internal use only -
getInputs
Internal use only -
getOutputs
Internal use only -
getMemories
Internal use only -
deferredClose
public void deferredClose()Internal use only -
getMemoryGroups
Internal use only -
getMailservers
Internal use only -
getJDBCLookups
Internal use only -
getTempQueues
Internal use only -
create
Returns a stream builder to create stream resources- Returns:
- stream builder
-
input
Returns the Input with the given name.- Parameters:
name
- Name of the Input- Returns:
- Input
-
input
Returns the Input for this TempQueue.- Parameters:
tempQueue
- temp queue- Returns:
- Input
-
output
Returns the Output with the given name.- Parameters:
name
- Name of the Output- Returns:
- Output
-
jdbcLookup
Returns the JDBCLookup with the given name.- Parameters:
name
- Name of the JDBCLookup- Returns:
- JDBCLookup
-
mailserver
Returns the MailServer with the given name.- Parameters:
name
- Name of the MailServer- Returns:
- MailServer
-
timer
Returns the Timer with the given name.- Parameters:
name
- Name of the Timer- Returns:
- Timer
-
memory
Returns the Memory with the given name.- Parameters:
name
- Name of the Memory- Returns:
- Memory
-
memoryGroup
Returns the MemoryGroup with the given name.- Parameters:
name
- Name of the MemoryGroup- Returns:
- MemoryGroup
-
tempQueue
Returns the TempQueue with the given name.- Parameters:
name
- Name of the TempQueue- Returns:
- TempQueue
-
queue
Factory method to return a new QueueImpl (address)- Parameters:
name
- queue name- Returns:
- QueueImpl
-
topic
Factory method to return a new TopicImpl (address)- Parameters:
name
- topic name- Returns:
- TopicImpl
-
lookupJNDI
Returns a Destination registered in JNDI under this name.- Parameters:
name
- Name at which the Destination is registered- Returns:
- Destination
- Throws:
Exception
-
purgeOutputs
Closes all Outputs that were not used between the last and this call to this method.- Returns:
- this
-
current
Sets/overwrites the currently processed Message.- Parameters:
current
- current Message- Returns:
- Stream
-
current
Returns the currently processed Message. This is automatically set from the stream processor before calling onMessage and set to null thereafter.- Returns:
- current Message
-
onMessage
Sets the onMessage callback.- Parameters:
runnable
- callback- Returns:
- Stream
-
onException
Sets the onException callback.- Parameters:
runnable
- callback- Returns:
-
onStart
Sets the onStart callback.- Parameters:
runnable
- callback- Returns:
-
onStop
Sets the onStop callback.- Parameters:
runnable
- callback- Returns:
-
executeCallback
Executes a function callback in the Stream's event queue. This is one method to execute asynchronous calls from libraries. This does not work in GraalVM. Please use stream.async(...)- Parameters:
functionCallback
- callbackcontext
- optional context- Returns:
- this
-
async
Wraps an async callback with a proxy that implements the interface given by the "interfaceClassName" and runs the callback on the Stream's event queue. This works on GraalVM and Nashorn.- Parameters:
interfaceClassName
- Fully qualified class name of the interface to implementcallback
- Callback- Returns:
- proxy object
- Throws:
Exception
-
lastException
Returns the last exception occurred on the stream- Returns:
- last exception
-
lastStackTrace
Returns the formatted stack trace of the last exception occurred on the stream- Returns:
- stack trace
-
executeOnExceptionCallback
public void executeOnExceptionCallback()Internal use only -
executeOnMessageCallback
Internal use only- Throws:
Exception
-
executeOnStartCallback
public void executeOnStartCallback()Internal use only -
executeOnStopCallback
public void executeOnStopCallback()Internal use only -
collect
public void collect(long interval) Internal use only -
start
Internal use only- Throws:
Exception
-
close
public void close()Internal use only -
toString
-