[
https://issues.apache.org/jira/browse/BEAM-8218?focusedWorklogId=719055&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-719055
]
ASF GitHub Bot logged work on BEAM-8218:
----------------------------------------
Author: ASF GitHub Bot
Created on: 01/Feb/22 22:35
Start Date: 01/Feb/22 22:35
Worklog Time Spent: 10m
Work Description: MarcoRob commented on a change in pull request #16634:
URL: https://github.com/apache/beam/pull/16634#discussion_r797100957
##########
File path:
sdks/java/io/pulsar/src/main/java/org/apache/beam/sdk/io/pulsar/ReadFromPulsarDoFn.java
##########
@@ -0,0 +1,219 @@
+package org.apache.beam.sdk.io.pulsar;
+
+import com.google.common.annotations.VisibleForTesting;
+import org.apache.beam.sdk.coders.Coder;
+import org.apache.beam.sdk.io.range.OffsetRange;
+import org.apache.beam.sdk.transforms.DoFn;
+import org.apache.beam.sdk.transforms.SerializableFunction;
+import org.apache.beam.sdk.transforms.splittabledofn.*;
+import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
+import org.apache.pulsar.client.admin.PulsarAdmin;
+import org.apache.pulsar.client.admin.PulsarAdminException;
+import org.apache.pulsar.client.api.*;
+import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Supplier;
+import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Suppliers;
+import org.joda.time.Instant;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.concurrent.*;
+
[email protected]
+@SuppressWarnings("rawtypes")
+public class ReadFromPulsarDoFn extends DoFn<PulsarSourceDescriptor,
PulsarMessage> {
+
+ private static final Logger LOGGER =
LoggerFactory.getLogger(ReadFromPulsarDoFn.class);
+ private PulsarClient client;
+ private PulsarAdmin admin;
+ private String clientUrl;
+ private String adminUrl;
+
+ @VisibleForTesting Reader<byte[]> readerTst;
Review comment:
As you can see in the SDF, I made the connection with Pulsar client and
then create a subscription with the topic through the reader. So in the unit
testing of the reader SDF I use a mock reader, which I need to pass in the SDF
so instead of make a connection with pulsar it uses the mock reader, as you can
see in `ReadFromPulsarDoFnTest` in `@Setup`. Is there any suggestion on how can
I avoid this so i don't have any code for test in main class?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 719055)
Time Spent: 9h (was: 8h 50m)
> Implement Apache PulsarIO
> -------------------------
>
> Key: BEAM-8218
> URL: https://issues.apache.org/jira/browse/BEAM-8218
> Project: Beam
> Issue Type: Task
> Components: io-ideas
> Reporter: Alex Van Boxel
> Assignee: Marco Robles
> Priority: P3
> Time Spent: 9h
> Remaining Estimate: 0h
>
> Apache Pulsar is starting to gain popularity. Having a native Beam PulsarIO
> could be beneficial.
> [https://pulsar.apache.org/|https://pulsar.apache.org/en/]
--
This message was sent by Atlassian Jira
(v8.20.1#820001)