[ https://issues.apache.org/jira/browse/BEAM-7738?focusedWorklogId=332064&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-332064 ]
ASF GitHub Bot logged work on BEAM-7738: ---------------------------------------- Author: ASF GitHub Bot Created on: 22/Oct/19 16:18 Start Date: 22/Oct/19 16:18 Worklog Time Spent: 10m Work Description: mxm commented on pull request #9268: [BEAM-7738] Add external transform support to PubsubIO URL: https://github.com/apache/beam/pull/9268#discussion_r337616849 ########## File path: sdks/python/apache_beam/io/external/gcp/pubsub.py ########## @@ -0,0 +1,160 @@ +# +# 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. +# + +from __future__ import absolute_import + +import typing + +from past.builtins import unicode + +import apache_beam as beam +from apache_beam.io.gcp import pubsub +from apache_beam.transforms import Map +from apache_beam.transforms.external import ExternalTransform +from apache_beam.transforms.external import NamedTupleBasedPayloadBuilder + +ReadFromPubsubSchema = typing.NamedTuple( + 'ReadFromPubsubSchema', + [ + ('topic', typing.Optional[unicode]), + ('subscription', typing.Optional[unicode]), + ('id_label', typing.Optional[unicode]), + ('with_attributes', bool), + ('timestamp_attribute', typing.Optional[unicode]), + ] +) + + +class ReadFromPubSub(beam.PTransform): + """An external ``PTransform`` for reading from Cloud Pub/Sub.""" Review comment: Can be done in a follow-up. ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 332064) Time Spent: 6h 40m (was: 6.5h) > Support PubSubIO to be configured externally for use with other SDKs > -------------------------------------------------------------------- > > Key: BEAM-7738 > URL: https://issues.apache.org/jira/browse/BEAM-7738 > Project: Beam > Issue Type: New Feature > Components: io-java-gcp, runner-flink, sdk-py-core > Reporter: Chad Dombrova > Assignee: Chad Dombrova > Priority: Major > Labels: portability > Time Spent: 6h 40m > Remaining Estimate: 0h > > Now that KafkaIO is supported via the external transform API (BEAM-7029) we > should add support for PubSub. -- This message was sent by Atlassian Jira (v8.3.4#803005)