[ https://issues.apache.org/jira/browse/KAFKA-10567?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17206129#comment-17206129 ]
shriram commented on KAFKA-10567: --------------------------------- Gone through the API's which doesn't have any api to bind the source address. Raising this because we have multiple interfaces. i can manage with static routes in this case but in production we are not allowed to access the system unless there is a problem. Also it will affect the other oam scenarios. > Choose ip address while producing messages to kafka broker. > ----------------------------------------------------------- > > Key: KAFKA-10567 > URL: https://issues.apache.org/jira/browse/KAFKA-10567 > Project: Kafka > Issue Type: New Feature > Components: producer > Affects Versions: 2.5.0 > Reporter: shriram > Priority: Major > > 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. > > The reason i am posting here is Camel is packaging the apache kafka clients > with their package. So please don't take this as a camel post. > > Please find the SO link > https://stackoverflow.com/questions/63898065/choose-source-ip-address-while-sending-messages-in-camel-kafka -- This message was sent by Atlassian Jira (v8.3.4#803005)