[ 
https://issues.apache.org/jira/browse/FLINK-4053?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15351793#comment-15351793
 ] 

ASF GitHub Bot commented on FLINK-4053:
---------------------------------------

Github user mushketyk commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2128#discussion_r68654363
  
    --- Diff: 
flink-streaming-connectors/flink-connector-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/RMQSink.java
 ---
    @@ -76,6 +76,9 @@ public void open(Configuration config) throws Exception {
                try {
                        connection = factory.newConnection();
                        channel = connection.createChannel();
    +                   if (channel == null) {
    --- End diff --
    
    As far as I understand in RabbitMQ every real TCP connection has a number 
of virtual connections implemented on top of it. If we request a channel and 
it's not available "createChannel" returns null.
    I've updated the exception message to reflect that.
    
    I don't think this generally will be an issue, since we only request one 
channel for a connection, but it would be beneficial to throw an exception with 
an appropriate message instead of a NullPointerException in case if anything 
goes wrong.


> Return value from Connection should be checked against null
> -----------------------------------------------------------
>
>                 Key: FLINK-4053
>                 URL: https://issues.apache.org/jira/browse/FLINK-4053
>             Project: Flink
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: Ivan Mushketyk
>            Priority: Minor
>
> In RMQSource.java and RMQSink.java, there is code in the following pattern:
> {code}
>       connection = factory.newConnection();
>       channel = connection.createChannel();
> {code}
> According to 
> https://www.rabbitmq.com/releases/rabbitmq-java-client/current-javadoc/com/rabbitmq/client/Connection.html#createChannel()
>  :
> {code}
> Returns:
> a new channel descriptor, or null if none is available
> {code}
> The return value should be checked against null.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to