Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13

Thread: TCP outbound gateway connection pool issue

  1. #11
    Join Date
    Nov 2012
    Posts
    13

    Default

    Thank you very much for your quick response.

    First I tried with tcp outbound gateway but the issue was when put under load and when the limit of the pool is reached it begins to throws following errors.


    Code:
    TcpOutboundGateway [ERROR] Tcp Gateway exception
    java.net.SocketException: Socket closed
             at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116)
             at java.net.SocketOutputStream.write(SocketOutputStream.java:132)


    since the outbound gateway should only be used for relatively low-volume use thought of including outbound and inbound channel adapters.



    When changed the config file as below I was able to get the response by using service activator.


    Code:
    <int:channel id="sendMessageChannel" />
    	<int:channel id="sendXMLMessageChannel" />
    	<int:channel id="sendStringMessageChannel" />
    	<int:channel id="recieveStringMessageChannelIn" />
    
    	<int:publish-subscribe-channel id="recieveStringMessageChannel2" />
    		
    		
    	<int:gateway id="jposGateway"
    		service-interface="com.gateway.infrastructure.JPOSGateway">
    		<int:method name="sendMessage" request-channel="sendMessageChannel" />
    	</int:gateway>
    	
    	
    	<int-xml:marshalling-transformer
    		marshaller="marshaller" input-channel="sendMessageChannel"
    		output-channel="sendXMLMessageChannel" result-type="StringResult" />
    
    	<int:object-to-string-transformer id="transformerBytes2String"
    		input-channel="sendXMLMessageChannel" output-channel="sendStringMessageChannel" />
    
    	<int-ip:tcp-connection-factory id="client"
    		deserializer="deserializer" type="client" host="${socket.host}"
    		port="${socket.port}" single-use="false" so-timeout="20000"/>
    		
    	<int-ip:tcp-outbound-channel-adapter id="outAdapter.client"
    		channel="sendStringMessageChannel"
    		connection-factory="client" /> 
    
    	
    	<int-ip:tcp-inbound-channel-adapter id="inAdapter.client"
    		channel="recieveStringMessageChannelIn"
    		connection-factory="client"/>
    
    
    	 <int:header-enricher input-channel="recieveStringMessageChannelIn" output-channel="recieveStringMessageChannel">
        		<int:error-channel ref="receive"/> 
         	 <int:reply-channel ref="recieveStringMessageChannel2" />
    	 </int:header-enricher>
    	 
    	
    	<bean id="deserializer" class="com.gateway.infrastructure.SocketInputStreamDeserializer" />
    		
    		
    		
    	<int-xml:unmarshalling-transformer
    		unmarshaller="marshaller" input-channel="recieveStringMessageChannel" output-channel="recieveStringMessageChannel2"
    		 />
    		
    
    	<bean id="receive" class="org.springframework.integration.core.MessagingTemplate$TemporaryReplyChannel" >
    		<constructor-arg type="long" value="1000"/>
    		</bean>
    
    	
    	
     <bean id="test" class="com.gateway.infrastructure.ServiceActivator" />
    		
    	
     
    	<int:service-activator method="runthis" input-channel="recieveStringMessageChannel2"
    		ref="test" />


    But even in this approach when put under a load I am still getting the exeption.

    Code:
    java.net.SocketException: Socket is closed
    	at java.net.Socket.getOutputStream(Socket.java:808)
    	at org.springframework.integration.ip.tcp.connection.TcpNetConnection.send(TcpNetConnection.java:69)
    	at org.springframework.integration.ip.tcp.TcpSendingMessageHandler.doWrite(TcpSendingMessageHandler.java:146)
    	... 50 more

    Really appreciate your help.

    Thanks.

  2. #12
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,020

    Default

    Are you sure the server can cope with the volume?
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #13
    Join Date
    Nov 2012
    Posts
    13

    Default

    As far as I know it can.But I'll try to get the vendor confirmation on this.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •