title: Send Acknowledgement to Sender in Spring Integration : tcp-in/out-channel-adapter
body: <p>I have made distributed applications.
  1. Web Application and 2. Spring Integration Console Application.</p>
  
  <p>I can send data from one to other and do background work using console application but I want acknowledgement that data received receiver side to sender.</p>
  
  <p>Sender should get acknowledgement.</p>
  
  <p>My code : </p>
  
  <p><strong>Web Application Side(Sender/Client) :</strong></p>
  
  <p>xml :</p>
  
  <pre><code>    &lt;bean id="javaSerializer" class="org.springframework.core.serializer.DefaultSerializer"/&gt;
      &lt;bean id="javaDeserializer" class="org.springframework.core.serializer.DefaultDeserializer"/&gt;
      &lt;int-ip:tcp-connection-factory id="client" type="client" host="localhost" port="56565" single-use="true" so-timeout="10000" deserializer="javaDeserializer" serializer="javaSerializer"/&gt;
      &lt;int:channel id="input" /&gt;
      &lt;int-ip:tcp-outbound-channel-adapter id="outboundClient" channel="input" connection-factory="client"/&gt;
  </code></pre>
  
  <p>code while login :</p>
  
  <pre><code>    ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:/esb/sender/sender-esb.xml");
      MessageChannel esbChannel = applicationContext.getBean("input",MessageChannel.class);
      Message&lt;String&gt; esbMsg = MessageBuilder.withPayload(form.getPatronID()).build();
      esbChannel.send(esbMsg);
  </code></pre>
  
  <p><strong>Spring-Integration Application side(server / receiver) :</strong></p>
  
  <p>xml :</p>
  
  <pre><code>    &lt;bean id="javaSerializer" class="org.springframework.core.serializer.DefaultSerializer"/&gt;
      &lt;bean id="javaDeserializer" class="org.springframework.core.serializer.DefaultDeserializer"/&gt;
      &lt;int-ip:tcp-connection-factory id="server" type="server" host="localhost" port="56565" single-use="true" so-timeout="10000" deserializer="javaDeserializer" serializer="javaSerializer"/&gt;
      &lt;int-ip:tcp-inbound-channel-adapter id="inboundServer" channel="inputChannel" connection-factory="server"/&gt;
      &lt;int:channel id="inputChannel"&gt; &lt;int:queue capacity="100" /&gt;&lt;/int:channel&gt;
      &lt;int:channel id="outputChannel"/&gt;
      &lt;int:service-activator id="loginChannel" input-channel="inputChannel" ref="ESBReceiver" method="getDataFromGL" output-channel="outputChannel"&gt;
          &lt;int:poller fixed-rate="500" error-channel="outputChannel" /&gt;
      &lt;/int:service-activator&gt;
      &lt;int:logging-channel-adapter id="esbLogger" level="DEBUG"/&gt;
      &lt;int:wire-tap channel="esbLogger"&gt;&lt;/int:wire-tap&gt;
  </code></pre>
  
  <p>java code to fetch request :</p>
  
  <p>run app :</p>
  
  <pre><code>    public static void main(String[] args) {
          ApplicationContext context = new ClassPathXmlApplicationContext("/receiver/receiver-esb.xml");
      }
  </code></pre>
  
  <p>class to process request :</p>
  
  <pre><code>    @Component
      public class ESBReceiver {
          public void getDataFromGL(String msg){
              System.out.println("From GL We Get :: " + msg);
              System.out.println("Length :: " + msg.length());
          }
      }
  </code></pre>
  
  <p>in ESBReceiver class I am logging data about user login time and logout time.</p>
  
  <p>I want to send acknowledgement from this class to my web application.
  So is it possible ? if yes then any guidance please.</p>