corvus-ch / rabbitmq-cli-consumer

Consume RabbitMQ messages into any cli program
MIT License
236 stars 36 forks source link

--include option should work with pipe #59

Open estahn opened 5 years ago

estahn commented 5 years ago

It would be great to just read a JSON from STDIN instead of reading from different file descriptors.

corvus-ch commented 5 years ago

I have starte working on a new major version. One of my goals is to simplify a lot. One thing I am taking into consideration is to remove support for passing the payload by argument. If I proceed proceed with that idea, I would like to also reject that request. This is due to the fact that a message body can be arbitrary binary data. In order to place it into a JSON data structure, the body would have to be encoded with the consumer and decoded within the worker script. This reduces the throughput this consumer can handle.

So the options are:

  1. Read from two file descriptors and run json decode on one of them. (less memory usage, less computing required)
  2. Read from one file descriptor and run json decode. Extract one field and decode it again (e.g base64). (more computing and memory required)

@estahn What would be your argument to have both attributes and body within the same data structure?