I am using camel KAFKA inside Apache KARAF and producing messages to KAFKA server. I have multiple interfaces configured in my system and sending(producing) messages will happen only by using the first interface managmentserver1_local_interface always. Same thing i tried with camel-ftp in which i can choose the network interface by using the name "managmentserver1_traffic_interface" and binding through the bindAddress api which is introduced after 2.23. Is there any way to configure the camel kafka component to select network nterfaces? Currently my machine has 2 network interfaces.
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.198.10.1 testserver1 managementserver1_local_interface
192.199.11.2 testserver1 managementserver1_traffic_interface
Gone through the source code of kafka and found that internally it is creating a socket which is used for transferring which will provide the option to bind source address.
private void configureSocketChannel(SocketChannel socketChannel, int sendBufferSize, int receiveBufferSize)
throws IOException {
socketChannel.configureBlocking(false);
Socket socket = socketChannel.socket();
socket.setKeepAlive(true);
if (sendBufferSize != Selectable.USE_DEFAULT_BUFFER_SIZE)
socket.setSendBufferSize(sendBufferSize);
if (receiveBufferSize != Selectable.USE_DEFAULT_BUFFER_SIZE)
socket.setReceiveBufferSize(receiveBufferSize);
socket.setTcpNoDelay(true);
}
Note: There is an option to choose the network interface in camel-ftp through an attribute bindAddress which allows us to bind the source addressees(in case of multiple interfaces). We are using camel 2.23. Because we are planning to handle the traffic only through traffic interface and oam activities through only management server local interface.