I have to create tcp server which reponse to request to the client and also send the event to the client at fixed frequency.Tcp server code:
from("netty:tcp://localhost:7100?sync=true&allowDefaultCodec=false&encoder=#stringEncode&decoder=#stringDecode")
.to("bean:echoService");
EchoService bean code is called when my server has to send response to msg from client
@Service
public class EchoService {
public String sayHello(Object guestName) {
System.out.println("Input guestName : "+ guestName);
return "Hello " + guestName;
}
}
And I have another MessageService bean which send the Hi message at fixed frequency.I want to integrate this bean to my server so that I can send "Hi" msg to client
@Service
public class MessageService {
public String sayHi() {
System.out.println("sending hi : ");
return "Hi ";
}
}
I am not able to decide how to integrate MessageService bean "hi" msg with tcp server to send TCP client.PS:- I am new to camel.