Class QueueWireTapInput
- All Implemented Interfaces:
DestinationInput,Input
Messages are sent to the WireTap when the Message is inserted into the Queue. If the WireTap has multiple subscribers (that is, Streams are using the same WireTap name), Messages are distributed evenly over the subscribers in a round-robin fashion.
Per default, a deep copy of a Message is performed before it is transferred to a subscriber. So it is save to change it. If the Message will not be changed by a subscriber, the deep copy can be disabled. But be careful! All changes of a Message will have side effects.
Message transfer to a WireTap subscriber is done outside of a transaction. The Subscriber uses a BlockingQueue to receive the Messages. The BlockingQueue has a bufferSize which is 10 Messages per default. If the size is reached, the Queue waits until there is free space. The time to wait is specified in maxBlockTime with a default of 500 ms. If the timeout is reached, the Message will not be inserted, so a WireTap subscriber may not receive all Messages transferred through the Queue. For that reason, a WireTap is a good solution if Message lost can be tolerated, e.g. in statistic scenarios.
- Author:
- IIT Software GmbH, Muenster/Germany, (c) 2017, All Rights Reserved
-
Method Summary
Modifier and TypeMethodDescriptionbufferSize(int bufferSize) Sets the bufferSize of the internal BlockingQueue.voidclose()Closes this Input.voidcollect(long interval) Internal use.current()Returns the current Message of this Input.Sets the current Message on this Input.Returns the destinationNamedestinationName(String destinationName) Sets the destinationName if different from the name used in stream.create().input(name)voidInternal use.Internal use.getName()Returns the name of this Input.Internal use.booleanisSelected(MessageImpl message) Internal use.maxBlockTime(long maxBlockTime) Sets the maximum block time when the internal BlockingQueue is full.next()Internal use.onInput(InputCallback callback) Sets the onInput callback.voidputMessage(MessageImpl message) Internal use.booleanReturns whether Message inserts requires a deep copy (default is true).requiresDeepCopy(boolean requiresDeepCopy) Sets whether the Message inserts requires a deep copy in order to change it later on.Sets the JMS Message SelectorvoidsetMessageProcessor(QueueMessageProcessor messageProcessor) Internal use.voidstart()Starts this Input.toString()
-
Method Details
-
getMessageProcessor
Description copied from interface:DestinationInputInternal use.- Specified by:
getMessageProcessorin interfaceDestinationInput
-
destinationName
Description copied from interface:DestinationInputSets the destinationName if different from the name used in stream.create().input(name)- Specified by:
destinationNamein interfaceDestinationInput- Parameters:
destinationName- destinationName- Returns:
- DestinationInput
-
destinationName
Description copied from interface:DestinationInputReturns the destinationName- Specified by:
destinationNamein interfaceDestinationInput- Returns:
- destinationName
-
bufferSize
Sets the bufferSize of the internal BlockingQueue. Default is 10 Messages.- Parameters:
bufferSize- Buffer Size- Returns:
- this
-
maxBlockTime
Sets the maximum block time when the internal BlockingQueue is full. Default is 500 ms. If the time is reached, the Message will not be inserted.- Parameters:
maxBlockTime- Max Block Time- Returns:
- this
-
requieresDeepCopy
public boolean requieresDeepCopy()Returns whether Message inserts requires a deep copy (default is true).- Returns:
- deepCopy flag
-
requiresDeepCopy
Sets whether the Message inserts requires a deep copy in order to change it later on. Default is true.- Parameters:
requiresDeepCopy- deepCopy flag- Returns:
- this
-
isSelected
public boolean isSelected(MessageImpl message) Internal use. -
putMessage
public void putMessage(MessageImpl message) Internal use. -
next
Internal use. -
setMessageProcessor
Description copied from interface:DestinationInputInternal use.- Specified by:
setMessageProcessorin interfaceDestinationInput
-
getName
Description copied from interface:InputReturns the name of this Input. -
getSelector
Internal use.- Specified by:
getSelectorin interfaceDestinationInput- Returns:
- JMS Message Selector
-
selector
Description copied from interface:DestinationInputSets the JMS Message Selector- Specified by:
selectorin interfaceDestinationInput- Parameters:
selector- JMS Message Selector- Returns:
- DestinationInput
-
current
Description copied from interface:InputSets the current Message on this Input. -
current
Description copied from interface:InputReturns the current Message of this Input. -
onInput
Description copied from interface:DestinationInputSets the onInput callback.- Specified by:
onInputin interfaceDestinationInput- Parameters:
callback- callback- Returns:
- DestinationInput
-
executeCallback
Description copied from interface:InputInternal use.- Specified by:
executeCallbackin interfaceInput- Throws:
Exception
-
collect
public void collect(long interval) Description copied from interface:InputInternal use. -
start
Description copied from interface:InputStarts this Input. This method is called automatically if an Input is created outside a callback. If it is created inside, it must be called explicitly. -
close
public void close()Description copied from interface:InputCloses this Input. -
toString
-