Skip to content

Rabbitmq output plugin : dynamic values on headers not working as type is Hash not String #42

@DIFRIN

Description

@DIFRIN

constant_properties = template.reject { |_,v| templated?(v) }
With this headers attributs of message_properties will fall all time in the constant_properties because it's not of type string

A Solution could be to extract constant_properties[:headers] then do the same as the variable_properties and reseting it in constant_properties before freezing. Something like

`
def buildHeaders(event)

      if @constant_properties[:headers]

        constant_headers = @constant_properties[:headers].reject { |_, v| templated?(v) }
        variable_headers = @constant_properties[:headers].select { |_, v| templated?(v) }

        headers = variable_headers.each_with_object(constant_headers.dup) do |(k, v), memo|
          memo.store(k, event.sprintf(v))
        end

        @constant_properties[:headers] = headers
        @constant_properties.freez
      end
    end`

@yaauie could you help us fix this issue ? Thank you in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions