[ 
https://issues.apache.org/jira/browse/BEAM-8513?focusedWorklogId=337198&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-337198
 ]

ASF GitHub Bot logged work on BEAM-8513:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/Nov/19 05:54
            Start Date: 01/Nov/19 05:54
    Worklog Time Spent: 10m 
      Work Description: jbonofre commented on pull request #9937: [BEAM-8513] 
Allow reads from exchange-bound queue without declaring the exchange
URL: https://github.com/apache/beam/pull/9937#discussion_r341458718
 
 

 ##########
 File path: 
sdks/java/io/rabbitmq/src/main/java/org/apache/beam/sdk/io/rabbitmq/RabbitMqIO.java
 ##########
 @@ -82,28 +97,31 @@
  *
  * <p>As for the {@link Read}, the {@link Write} is configured with a RabbitMQ 
URI.
  *
- * <p>For instance, you can write to an exchange (providing the exchange type):
+ * <p>Examples
  *
  * <pre>{@code
+ * // Publishing to a named, non-durable exchange, declared by Beam:
  * pipeline
  *   .apply(...) // provide PCollection<RabbitMqMessage>
  *   
.apply(RabbitMqIO.write().withUri("amqp://user:password@localhost:5672").withExchange("EXCHANGE",
 "fanout"));
- * }</pre>
  *
- * <p>For instance, you can write to a queue:
+ * // Publishing to an existing exchange
+ * pipeline
+ *   .apply(...) // provide PCollection<RabbitMqMessage>
+ *   
.apply(RabbitMqIO.write().withUri("amqp://user:password@localhost:5672").withExchange("EXCHANGE"));
  *
- * <pre>{@code
+ * // Publishing to a named queue in the default exchange:
  * pipeline
  *   .apply(...) // provide PCollection<RabbitMqMessage>
  *   
.apply(RabbitMqIO.write().withUri("amqp://user:password@localhost:5672").withQueue("QUEUE"));
- *
  * }</pre>
  */
 @Experimental(Experimental.Kind.SOURCE_SINK)
 public class RabbitMqIO {
   public static Read read() {
     return new AutoValue_RabbitMqIO_Read.Builder()
         .setQueueDeclare(false)
+        .setExchangeDeclare(false)
 
 Review comment:
   I remember I discussed about that when I created the IO. I don't remember 
why I didn't do that finally. It makes sense anyway, thanks !
 
----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 337198)
    Time Spent: 2h 10m  (was: 2h)

> RabbitMqIO: Allow reads from exchange-bound queue without declaring the 
> exchange
> --------------------------------------------------------------------------------
>
>                 Key: BEAM-8513
>                 URL: https://issues.apache.org/jira/browse/BEAM-8513
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-rabbitmq
>         Environment: testing with DirectRunner
>            Reporter: Nick Aldwin
>            Assignee: Jean-Baptiste Onofré
>            Priority: Critical
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> The RabbitMqIO always declares an exchange if it is configured to read from 
> it.  This is problematic with pre-existing exchanges (a relatively common 
> pattern), as there's no provided configuration for the exchange beyond 
> exchange type.  (We stumbled on this because RabbitMqIO always declares a 
> non-durable exchange, which fails if the exchange already exists as a durable 
> exchange)
>  
> A solution to this would be to allow RabbitMqIO to read from an exchange 
> without declaring it.  This pattern is already available for queues via the 
> `queueDeclare` flag.  I propose an `exchangeDeclare` flag which preserves 
> existing behavior except for skipping the call to `exchangeDeclare` before 
> binding the queue to the exchange.
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to