@Bean public TcpInboundGateway tcpInGate(AbstractServerConnectionFactory connectionFactory) { TcpInboundGateway inGate = new TcpInboundGateway(); inGate.setConnectionFactory(connectionFactory); inGate.setRequestChannel(fromTcp()); return inGate; }
@Bean @ServiceActivator(inputChannel = "toTcp") public MessageHandler tcpOutGate(AbstractClientConnectionFactory connectionFactory) { TcpOutboundGateway gate = new TcpOutboundGateway(); gate.setConnectionFactory(connectionFactory); gate.setOutputChannelName("resultToString"); return gate; }
/** * Construct an instance using an existing spring-managed connection factory. * @param connectionFactoryBean the spring-managed bean. */ TcpOutboundChannelAdapterSpec(AbstractConnectionFactory connectionFactoryBean) { this.target = new TcpSendingMessageHandler(); this.connectionFactory = null; this.target.setConnectionFactory(connectionFactoryBean); }
/** * Construct an instance using an existing spring-managed connection factory. * @param connectionFactoryBean the spring-managed bean. */ TcpInboundChannelAdapterSpec(AbstractConnectionFactory connectionFactoryBean) { super(new TcpReceivingChannelAdapter()); this.connectionFactory = null; this.target.setConnectionFactory(connectionFactoryBean); }
/** * Construct an instance using an existing spring-managed connection factory. * @param connectionFactoryBean the spring-managed bean. */ public TcpOutboundGatewaySpec(AbstractClientConnectionFactory connectionFactoryBean) { this.target = new TcpOutboundGateway(); this.connectionFactory = null; this.target.setConnectionFactory(connectionFactoryBean); }
/** * Construct an instance using an existing spring-managed connection factory. * @param connectionFactoryBean the spring-managed bean. */ TcpInboundGatewaySpec(AbstractConnectionFactory connectionFactoryBean) { super(new TcpInboundGateway()); this.connectionFactory = null; this.target.setConnectionFactory(connectionFactoryBean); }
/** * Specify the Spring Integration reply channel. If this property is not * set the gateway will check for a 'replyChannel' header on the request. * @param replyChannel The reply channel. */ public void setReplyChannel(MessageChannel replyChannel) { this.setOutputChannel(replyChannel); }
/** * Specify the Spring Integration reply channel name. If this property is not * set the gateway will check for a 'replyChannel' header on the request. * @param replyChannel The reply channel. * @since 5.0 */ public void setReplyChannelName(String replyChannel) { this.setOutputChannelName(replyChannel); }
@Override public int afterShutdown() { this.stop(); return this.activeCount.get(); } }
/** * @param taskScheduler the scheduler for connecting in client mode. * @return the spec. * @see TcpReceivingChannelAdapter#setTaskScheduler(TaskScheduler) */ public TcpInboundChannelAdapterSpec taskScheduler(TaskScheduler taskScheduler) { this.target.setTaskScheduler(taskScheduler); return _this(); }
/** * @param taskScheduler the scheduler for connecting in client mode. * @return the spec. * @see TcpInboundGateway#setTaskScheduler(TaskScheduler) */ public TcpInboundGatewaySpec taskScheduler(TaskScheduler taskScheduler) { this.target.setTaskScheduler(taskScheduler); return _this(); }
/** * @param isClientMode true to connect in client mode * @return the spec. * @see TcpInboundGateway#setClientMode(boolean) */ public TcpInboundGatewaySpec clientMode(boolean isClientMode) { this.target.setClientMode(isClientMode); return _this(); }
/** * @param retryInterval the client mode retry interval to set. * @return the spec. * @see TcpInboundGateway#setRetryInterval(long) */ public TcpInboundGatewaySpec retryInterval(long retryInterval) { this.target.setRetryInterval(retryInterval); return _this(); }
/** * @param remoteTimeout the remote timeout to set. * @return the spec. * @see TcpOutboundGateway#setRemoteTimeout(long) */ public TcpOutboundGatewaySpec remoteTimeout(long remoteTimeout) { this.target.setRemoteTimeout(remoteTimeout); return _this(); }
/** * @param isClientMode true to connect in client mode * @return the spec. * @see TcpSendingMessageHandler#setClientMode(boolean) */ public TcpOutboundChannelAdapterSpec clientMode(boolean isClientMode) { this.target.setClientMode(isClientMode); return _this(); }
/** * Writes the message payload to the underlying socket, using the specified * message format. * @see org.springframework.messaging.MessageHandler#handleMessage(org.springframework.messaging.Message) */ @Override public void handleMessageInternal(final Message<?> message) { if (this.serverConnectionFactory != null) { handleMessageAsServer(message); } else { handleMessageAsClient(message); } }
public static void main(String[] args) { new FactoryStopStartTests().testRestart(); } }
/** * Construct an instance using the provided connection factory spec. * @param connectionFactorySpec the spec. */ TcpOutboundChannelAdapterSpec(AbstractConnectionFactorySpec<?, ?> connectionFactorySpec) { this.target = new TcpSendingMessageHandler(); this.connectionFactory = connectionFactorySpec.get(); this.target.setConnectionFactory(this.connectionFactory); }
/** * Construct an instance using the supplied connection factory spec. * @param connectionFactorySpec the spec. */ public TcpOutboundGatewaySpec(TcpClientConnectionFactorySpec connectionFactorySpec) { this.target = new TcpOutboundGateway(); this.connectionFactory = connectionFactorySpec.get(); this.target.setConnectionFactory(this.connectionFactory); }