[
https://issues.apache.org/jira/browse/BAHIR-73?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15686042#comment-15686042
]
ASF GitHub Bot commented on BAHIR-73:
-------------------------------------
Github user rmetzger commented on a diff in the pull request:
https://github.com/apache/bahir-flink/pull/8#discussion_r89061655
--- Diff:
flink-connector-akka/src/main/java/org/apache/flink/streaming/connectors/akka/AkkaSource.java
---
@@ -0,0 +1,147 @@
+/*
+ * 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.akka;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import akka.actor.PoisonPill;
+import akka.actor.Props;
+import com.typesafe.config.Config;
+import com.typesafe.config.ConfigFactory;
+import org.apache.flink.api.common.functions.RuntimeContext;
+import org.apache.flink.api.common.functions.StoppableFunction;
+import org.apache.flink.configuration.Configuration;
+import org.apache.flink.streaming.api.functions.source.RichSourceFunction;
+import org.apache.flink.streaming.api.functions.source.SourceFunction;
+import org.apache.flink.streaming.api.operators.StreamingRuntimeContext;
+import org.apache.flink.streaming.connectors.akka.utils.ReceiverActor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of {@link SourceFunction} specialized to read messages
+ * from Akka actors.
+ */
+public class AkkaSource extends RichSourceFunction<Object>
+ implements StoppableFunction {
+
+ private static final Logger LOG =
LoggerFactory.getLogger(AkkaSource.class);
+
+ private static final long serialVersionUID = 1L;
+
+ // --- Fields set by the constructor
+
+ private final Class<?> classForActor;
+
+ private final String actorName;
+
+ private final String urlOfPublisher;
+
+ // --- Runtime fields
+ private transient ActorSystem receiverActorSystem;
+ private transient ActorRef receiverActor;
+ private transient Object waitLock;
+ private transient boolean running = true;
+
+ protected transient boolean autoAck;
+
+ /**
+ * Creates {@link AkkaSource} for Streaming
+ *
+ * @param actorName Receiver Actor name
+ * @param urlOfPublisher tcp url of the publisher or feeder actor
+ */
+ public AkkaSource(String actorName,
+ String urlOfPublisher) {
+ super();
+ this.classForActor = ReceiverActor.class;
+ this.actorName = actorName;
+ this.urlOfPublisher = urlOfPublisher;
+ }
+
+ @Override
+ public void open(Configuration parameters) throws Exception {
+ waitLock = new Object();
+ receiverActorSystem = createDefaultActorSystem();
+
+ RuntimeContext runtimeContext = getRuntimeContext();
+ if (runtimeContext instanceof StreamingRuntimeContext
+ && ((StreamingRuntimeContext)
runtimeContext).isCheckpointingEnabled()) {
+ autoAck = false;
+ } else {
+ autoAck = true;
--- End diff --
Why is the acking dependent on the checkpointing?
Maybe it would make sense to allow the user to configure this independently.
> [bahir-flink] flink-streaming-akka source connector
> ---------------------------------------------------
>
> Key: BAHIR-73
> URL: https://issues.apache.org/jira/browse/BAHIR-73
> Project: Bahir
> Issue Type: New Feature
> Components: Flink Streaming Connectors
> Reporter: Subhobrata Dey
> Fix For: Flink-0.1
>
>
> Hello,
> This issue is created to propose the idea of having a flink-streaming-akka
> source connector.
> The source connector can be used to receive messages from an Akka feeder or
> publisher actor & these messages can then be processed using flink streaming.
> The source connector has the following features.
> 1. It can supports several different message formats like iterable data,
> bytes array & data with timestamp.
> 2. It can send back acknowledgements to the feeder actor.
> Thanks & regards,
> Subhobrata
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)