Uploaded image for project: 'AMQ Streams'
  1. AMQ Streams
  2. ENTMQST-4503

[HTTP BRIDGE] Double quotes to wrap key and value in JSON are propagated to consumers

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Undefined Undefined
    • None
    • 2.2.0.GA
    • kafka-bridge
    • None
    • False
    • None
    • False

      Started by Bridge#410

      An HTTP client sends messages as JSON by having something like this.

      "key": "key-1",
      "value": "value-1", 

      The double quotes are just used in the JSON itself but they are not part of the key or value.

      An HTTP client consuming same messages via the bridge gets the following:

      "key": "key-1",
      "value": "value-1", 

      It is still right because double quotes are still used in the JSON itself but are not part of the key or value.

      But a consumer, not using the bridge, for example the kafka console consumer gets them as "key-1" and "value-1".

      They includes the double quotes, which is wrong. It means that in the underlying Kafka record the double quotes are stored by the bridge while handling the JSON.

      In the JSON from the producer they are there just for representing a string. A non bridge-based Kafka consumer should get just key-1 and value-1 with no quotes.

      The right approach to have quotes even when not received by a bridge-based consumer, should be that the producer (via bridge) has to escape quotes this way:

      "key": "\"key-1\"",
      "value": "\"value-1\"", 

       

              ppatiern Paolo Patierno
              ppatiern Paolo Patierno
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: