public class UnicastReceivingChannelAdapter extends AbstractInternetProtocolReceivingChannelAdapter
lifecycleCondition, lifecycleLock
EXPRESSION_PARSER, logger
DEFAULT_PHASE
Constructor and Description |
---|
UnicastReceivingChannelAdapter(int port)
Constructs a UnicastReceivingChannelAdapter that listens on the specified port.
|
UnicastReceivingChannelAdapter(int port,
boolean lengthCheck)
Constructs a UnicastReceivingChannelAdapter that listens for packets on
the specified port.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
asyncSendMessage(DatagramPacket packet) |
protected void |
doSend(DatagramPacket packet) |
protected void |
doStop()
Take no action by default.
|
String |
getComponentType()
Subclasses may implement this method to provide component type information.
|
int |
getPort() |
DatagramSocket |
getSocket() |
protected DatagramSocket |
getTheSocket() |
boolean |
isLongLived() |
protected void |
onInit()
Subclasses may implement this for initialization logic.
|
protected DatagramPacket |
receive() |
void |
run() |
protected void |
sendAck(Message<byte[]> message) |
void |
setLengthCheck(boolean lengthCheck) |
void |
setLookupHost(boolean lookupHost) |
void |
setSocket(DatagramSocket socket) |
protected void |
setSocketAttributes(DatagramSocket socket)
Sets timeout and receive buffer size; calls the socket customizer.
|
void |
setSocketCustomizer(SocketCustomizer socketCustomizer)
Set a customizer to further configure the socket after creation.
|
void |
setSoSendBufferSize(int soSendBufferSize) |
checkTaskExecutor, doStart, getApplicationEventPublisher, getLocalAddress, getReceiveBufferSize, getSoReceiveBufferSize, getSoTimeout, getTaskExecutor, isActive, isListening, setApplicationEventPublisher, setListening, setLocalAddress, setPoolSize, setReceiveBufferSize, setSoReceiveBufferSize, setSoTimeout, setTaskExecutor
afterSingletonsInstantiated, buildErrorMessage, getErrorChannel, getErrorMessageAttributes, getIntegrationPatternType, getMessagingTemplate, getOutputChannel, sendErrorMessageIfNecessary, sendMessage, setErrorChannel, setErrorChannelName, setErrorMessageStrategy, setOutputChannel, setOutputChannelName, setSendTimeout, setShouldTrack, subscribeToPublisher
destroy, doStop, getPhase, getRole, isAutoStartup, isRunning, setAutoStartup, setPhase, setRole, start, stop, stop
afterPropertiesSet, extractTypeIfPossible, generateId, getApplicationContext, getApplicationContextId, getBeanDescription, getBeanFactory, getBeanName, getChannelResolver, getComponentName, getConversionService, getExpression, getIntegrationProperties, getIntegrationProperty, getMessageBuilderFactory, getTaskScheduler, isInitialized, setApplicationContext, setBeanFactory, setBeanName, setChannelResolver, setComponentName, setConversionService, setMessageBuilderFactory, setPrimaryExpression, setTaskScheduler, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getBeanName, getComponentName
public UnicastReceivingChannelAdapter(int port)
port
- The port.public UnicastReceivingChannelAdapter(int port, boolean lengthCheck)
port
- The port.lengthCheck
- If true, enables the lengthCheck Option.public void setLengthCheck(boolean lengthCheck)
lengthCheck
- if true, the incoming packet is expected to have a four
byte binary length header.public void setSocketCustomizer(SocketCustomizer socketCustomizer)
socketCustomizer
- the customizer.public boolean isLongLived()
public int getPort()
getPort
in class AbstractInternetProtocolReceivingChannelAdapter
protected void onInit()
IntegrationObjectSupport
onInit
in class MessageProducerSupport
public void run()
protected void sendAck(Message<byte[]> message)
protected boolean asyncSendMessage(DatagramPacket packet)
protected void doSend(DatagramPacket packet)
protected DatagramPacket receive() throws IOException
IOException
public void setSocket(DatagramSocket socket)
socket
- the socket to set@Nullable protected DatagramSocket getTheSocket()
public DatagramSocket getSocket()
protected void setSocketAttributes(DatagramSocket socket) throws SocketException
socket
- The socket.SocketException
- Any socket exception.protected void doStop()
MessageProducerSupport
doStop
in class AbstractInternetProtocolReceivingChannelAdapter
public void setSoSendBufferSize(int soSendBufferSize)
soSendBufferSize
- The send buffer size.Socket.setSendBufferSize(int)
,
DatagramSocket.setSendBufferSize(int)
public void setLookupHost(boolean lookupHost)
public String getComponentType()
IntegrationObjectSupport
getComponentType
in interface NamedComponent
getComponentType
in class IntegrationObjectSupport