akoutmos/prom_ex

How to configure my pipelines for `PromEx.Plugins.Broadway`?

Closed this issue · 3 comments

The documentation says I need to add a transformer function like this:

  def transform(event, _opts) do
    %Message{
      data: event,
      acknowledger: {__MODULE__, :ack_id, :ack_data}
    }
  end

But event is a full %Broadway.Message{}, not just a data: field.
After I fix that (I think) with an example I found on another issue:

  def transform(%Message{acknowledger: {ack_module, ack_ref, ack_data}} = message, []) do
    %Message{message | acknowledger: {__MODULE__, {ack_module, ack_ref}, ack_data}}
  end

I start seeing errors of a missing ack() function. How do I implement that?

I'm using a RabbitMQ producer, if it helps.

Thank you for this project! It's a life saver.

Hey there! I have not actually had the chance to use PromEx with Broadway+RabbitMQ (unfortunately). But another contributor iirc did and updated the docs to reflect what he discovered: https://github.com/akoutmos/prom_ex/blob/master/lib/prom_ex/plugins/broadway.ex#L34-L70

A new release hasn't been cut yet with those docs changes, so the HexDocs ones may be misleading. Let me know if those docs solve your problem. If not I can dig in further!

I see you reopened this issue.
That solution worked fine for me, besides being a lot of boilerplate code in my pipelines.

Sounds good. I'll see if this boilerplate can be trimmed out :).