Accessing internal listener of AMQ Stream using credentials

Solution Unverified - Updated -

Environment

  • Red Hat AMQ Streams (AMQ Stream)
    • 2.2
  • Red Hat OpenShift Container Platform (RHOCP)
    • 4.10
  • AMQ Stream operator's custom resource configuration:

    listeners:
      - authentication:
          type: scram-sha-512
        name: plain
        port: 9092
        tls: false
    

Issue

  • How to access to the internal listener using credentials.

Resolution

Use the following command to access to the internal listener with the provided credentials:

$ oc run kafka-producer -ti --image=registry.redhat.io/amq7/amq-streams-kafka-32-rhel8:2.2.0 --rm=true --restart=Never -- /bin/bash -c "cat >/tmp/producer.properties <<EOF 
> security.protocol=SASL_PLAINTEXT
> sasl.mechanism=SCRAM-SHA-512
> sasl.jaas.config=org.apache.kafka.common.security.scram.ScramLoginModule required username=newuser password=newpassword;
> EOF
> bin/kafka-console-producer.sh --broker-list my-cluster-kafka-bootstrap:9092 --topic my-topic  --producer.config=/tmp/producer.properties
> "

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.