1 Reply Latest reply on Oct 13, 2014 6:29 AM by bmajsak

    Apache -Camel: Getting response from a remote tcp server using mina component

    jkaloli

      I have been working on a project that posts messages to a remote tcp server and I need the response from the server. In one of a hundred times I get the right response. in other times the response is simply Type 'exit' to quit

      I am using camel vs 2.13.2 as a  standalone and using mina tcp component.

       

      my code is :

       

      CamelContext context = new DefaultCamelContext();

       

              final String msg = "SECTOR,GCS/I,JKAB016/123123,333,DESCRIPTION::=\"this is it man\",SHORT.NAME::=\"integration\"";

              try {   

       

                  Endpoint e = context.getEndpoint("mina:tcp://127.0.0.1:7023?timeout=120000&textline=true&sync=true");

                  Exchange ex = e.createExchange(ExchangePattern.InOut);

       

                  ex.getIn().setBody(msg, String.class);

                  Producer p = e.createProducer();

                  p.start();

                  p.process(ex);

                  context.start();

                  String resp = ex.getOut().getBody(String.class);

       

                  System.out.println("t24 says: " + resp);

                  Thread.sleep(1000);

                  p.stop();

                  context.stop();

             

              } catch (Exception e) {

                  e.printStackTrace();

              }

       

       

      can someone point out to me how I can disable the message Type 'exit' to quit. so that I can get the right message from the server.

      Thanks