flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mushketyk <...@git.apache.org>
Subject [GitHub] flink pull request #2314: [FLINK-3298] Implement ActiveMQ streaming connecto...
Date Mon, 15 Aug 2016 21:32:36 GMT
Github user mushketyk commented on a diff in the pull request:

    --- Diff: flink-streaming-connectors/flink-connector-activemq/src/main/java/org/apache/flink/streaming/connectors/activemq/AMQSource.java
    @@ -0,0 +1,258 @@
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.flink.streaming.connectors.activemq;
    +import org.apache.activemq.ActiveMQConnectionFactory;
    +import org.apache.activemq.ActiveMQSession;
    +import org.apache.flink.api.common.functions.RuntimeContext;
    +import org.apache.flink.api.common.typeinfo.TypeInformation;
    +import org.apache.flink.api.java.typeutils.ResultTypeQueryable;
    +import org.apache.flink.configuration.Configuration;
    +import org.apache.flink.streaming.api.functions.source.MessageAcknowledgingSourceBase;
    +import org.apache.flink.streaming.api.operators.StreamingRuntimeContext;
    +import org.apache.flink.streaming.util.serialization.DeserializationSchema;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import javax.jms.BytesMessage;
    +import javax.jms.Connection;
    +import javax.jms.Destination;
    +import javax.jms.ExceptionListener;
    +import javax.jms.JMSException;
    +import javax.jms.Message;
    +import javax.jms.MessageConsumer;
    +import javax.jms.Session;
    +import java.io.Serializable;
    +import java.util.HashMap;
    +import java.util.List;
    + * Source for reading messages from an ActiveMQ queue.
    + * <p>
    + * To create an instance of AMQSink class one should initialize and configure an
    + * instance of a connection factory that will be used to create a connection.
    + * This source is waiting for incoming messages from ActiveMQ and converts them from
    + * an array of bytes into an instance of the output type. If an incoming
    + * message is not a message with an array of bytes, this message is ignored
    + * and warning message is logged.
    + *
    + * @param <OUT> type of output messages
    + */
    +public class AMQSource<OUT> extends MessageAcknowledgingSourceBase<OUT, String>
    +	implements ResultTypeQueryable<OUT> {
    +	private static final Logger LOG = LoggerFactory.getLogger(AMQSource.class);
    +	private final ActiveMQConnectionFactory connectionFactory;
    +	private final String queueName;
    +	private final DeserializationSchema<OUT> deserializationSchema;
    +	private boolean logFailuresOnly = false;
    +	private RunningChecker runningChecker;
    --- End diff --
    In some unit tests that I wrote need to execute "run" method exactly once.
    I think that it is simpler to achieve it using a separate interface that controls running
of source.
    To avoid confusion I'll add a comment describing this, but if you have a better idea of
how to achieve this, don't hesitate to suggest it.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.

View raw message