Search in sources :

Example 21 with AbstractConnectionFactory

use of org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory in project spring-integration by spring-projects.

the class TcpInboundGateway method publishNoConnectionEvent.

private void publishNoConnectionEvent(Message<?> message, String connectionId) {
    AbstractConnectionFactory cf = this.serverConnectionFactory != null ? this.serverConnectionFactory : this.clientConnectionFactory;
    ApplicationEventPublisher applicationEventPublisher = cf.getApplicationEventPublisher();
    if (applicationEventPublisher != null) {
        applicationEventPublisher.publishEvent(new TcpConnectionFailedCorrelationEvent(this, connectionId, new MessagingException(message, "Connection not found to process reply.")));
    }
}
Also used : TcpConnectionFailedCorrelationEvent(org.springframework.integration.ip.tcp.connection.TcpConnectionFailedCorrelationEvent) AbstractConnectionFactory(org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory) MessagingException(org.springframework.messaging.MessagingException) ApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)

Aggregations

AbstractConnectionFactory (org.springframework.integration.ip.tcp.connection.AbstractConnectionFactory)21 MessagingException (org.springframework.messaging.MessagingException)20 IOException (java.io.IOException)19 SocketException (java.net.SocketException)19 Test (org.junit.Test)19 ServerSocket (java.net.ServerSocket)18 Socket (java.net.Socket)18 CountDownLatch (java.util.concurrent.CountDownLatch)18 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)18 AtomicReference (java.util.concurrent.atomic.AtomicReference)18 QueueChannel (org.springframework.integration.channel.QueueChannel)14 TcpNetClientConnectionFactory (org.springframework.integration.ip.tcp.connection.TcpNetClientConnectionFactory)9 TcpNioClientConnectionFactory (org.springframework.integration.ip.tcp.connection.TcpNioClientConnectionFactory)9 ByteArrayCrLfSerializer (org.springframework.integration.ip.tcp.serializer.ByteArrayCrLfSerializer)8 HashSet (java.util.HashSet)7 ObjectInputStream (java.io.ObjectInputStream)6 ObjectOutputStream (java.io.ObjectOutputStream)6 DefaultDeserializer (org.springframework.core.serializer.DefaultDeserializer)6 DefaultSerializer (org.springframework.core.serializer.DefaultSerializer)6 Semaphore (java.util.concurrent.Semaphore)5