austince opened a new pull request #12729:
URL: https://github.com/apache/flink/pull/12729


   ## What is the purpose of the change
   
   This PR allows configuring the RabbitMQ source's prefetch count, allowing 
jobs to properly handle backpressure and fix the OOM issue that arises when too 
many messages are sent from the RMQ server to handle. This is left opt-in and 
shouldn't affect any current jobs if unset.
   
   FLINK-10195 contains the discussion around the tradeoffs and links to 
relevant docs/ proofs-of-concept. This takes some guidance from 
https://github.com/apache/flink/pull/8111, though just pulls in the RMQ 
QueueingConsumer and sets the channel prefetch instead of starting/ stopping 
the consumer. I have not updated the dependency to the latest version but have 
set us up to do so easily. Should I open up a new ticket for that, or just do 
it in this PR? 
   
   ## Brief change log
     - adds the ability to `setPrefetchCount` on the `RMQConnectionConfig` and 
its builder
     - breaks out creating the source's `Channel` into a protected method and 
configures the prefetch count, if set 
     - moves the `com.rabbitmq.client.QueueingConsumer` into Flink, as it is 
removed in later versions
     - adds licensing information for the `com.rabbitmq` package
   
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   - added `RMQSourceTest#testSetPrefetchCount`, which tests setting a prefetch 
count creates the channel with it 
   - added `RMQSinkTest#testUnsetPrefetchCount`, which tests leaving the 
prefetch count unset creates the channel as it normally does
   - added `RMQConnectionConfigTest#shouldReturnEmptyOptionalPrefetchCount`, 
which tests the returned `Optional` is empty when unset 
   - added `RMQConnectionConfigTest#shouldReturnEmptyOptionalPrefetchCount`, 
which tests the returned `Optional` is present when set 
   
   -- I would love to add an e2e test for this but unsure how to go about it. 
Would that best be done in another ticket?
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / **no**)
     - The public API, i.e., is any changed class annotated with 
`@Public(Evolving)`: (yes / **no**)
     - The serializers: (yes / **no** / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / **no** 
/ don't know)
     - Anything that affects deployment or recovery: JobManager (and its 
components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / **no** / 
don't know)
     - The S3 file system connector: (yes / **no** / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (**yes** / no)
     - If yes, how is the feature documented? (not applicable / **docs** / 
JavaDocs / not documented)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to