Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-10567

Choose ip address while producing messages to kafka broker.

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.5.0
    • None
    • producer
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            shri_22ram shriram
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: