Skip to content

Add support for multiple sinks/sources in a single NAR file. #3576

Closed

Description

@david-streamlio

Is your feature request related to a problem? Please describe.
We need to be able to bundle several related Pulsar IO connectors and functions into a single NAR file for deployment. The current implementation requires a separate NAR file for each sink/source pair, which in turn requires a separate project for each sink/source pair.

Describe the solution you'd like
Allow the definition of multiple sinks/sources in a single pulsar-io.yaml file, e.g.

name: aws-sqs-source
description: Amazon SQS
sourceClass: org.apache.pulsar.io.aws.sqs.SqsSource

name: aws-s3
description: Amazon S3
sourceClass: org.apache.pulsar.io.aws.s3.AwsS3Source

Activity

  1. added
    type/feature
    on Feb 12, 2019
  2. jerrypeng commented on Feb 12, 2019

    @jerrypeng
    Contributor

    @david-streamlio after some thinking bundling multiple sources or sinks in NARs is problematic for us to support. Our current reasoning for using the NAR format for connectors is so that users don't have to 1) upload anything (for built-in connectors) and 2) so that the user don't have to specify a classpath. If we were to bundle multiple sources or sinks in a single NAR, the user has to now specify a classpath or some identifier which adds not only complexity to our code but as well as user experience.

    Bundling multiple sources and sinks into a NAR makes sense for built-in connectors, but currently we also allow users to submit NARs from the CLI for source and sinks. Like I mentioned before, having to support submitting NARs with multiple sources and sinks adds a lot more additional complexity in the code as we must also support submitting NARs with single sources and sinks. We will have to support NARs of two different formats. User's will also have to uploaded a larger package than needed as the NAR with contain code and dependencies for other sources an sinks.

  3. david-streamlio commented on Feb 12, 2019

    @david-streamlio
    ContributorAuthor

    @jerrypeng This request is to accommodate packages of "related" processors that share several external dependencies, e.g. AWS-connectors all rely on aws-java-sdk jar file, so we would only have to package that once and all the classes in the org.apache.pulsar.io.aws.* packages could use the same single jar file.

    Currently the NiFi project packages several "processors" in each NAR file they maintain, so I don't think that it should be an issue for us either. This approach will NOT require users to 1) upload anything or 2) specify a classpath. Instead they would just need to specify the NAME of the connector when they submit the connector.

    e.g. bin/pulsar-admin source create --connectorName aws-sqs-source --archive ./pulsar-aws-nar-0.0.1.nar --name sqs-source --destination-topic-name sqs_data --source-config-file sqs-config.yaml

    Where aws-sqs-source matches the name in the pulsar-io.yaml file

    Can't we just parse the <name, classname> pairs from the pulsar-io.yaml file on job submission and load them in a map?

  4. david-streamlio commented on Feb 12, 2019

    @david-streamlio
    ContributorAuthor

    @jerrypeng To address you other points:

    We will have to support NARs of two different formats.

    Not if we require all NARs to have a pulsar-io.yaml or similar manifest. We can first parse that to determine the contents of the NAR and then lookup the className based on the <name, classname> pairs. This approach would support single and multiple connectors

    User's will also have to uploaded a larger package than needed as the NAR with contain code and dependencies for other sources an sinks.

    We can't prevent people from doing such things, and if used properly it would actually reduce the number of redundant jar files that are uploaded to Pulsar

  5. david-streamlio commented on Jul 2, 2019

    @david-streamlio
    ContributorAuthor

    We are starting to get requests for support for additional "types" within existing connectors and need to come up with some sort of strategy. / solution for this. For instance, we current have an HDFS Sink connector that accepts String input and a customer is requesting support for byte[] . This would be a very easy sink to write, but the packaging and deployment is the challenge.

  6. eolivelli commented on Dec 24, 2020

    @eolivelli
    Contributor

    @david-streamlio I am doing some tests in current master (2.8.0-SNAPSHOT),
    it looks like that if you pass "--classname" and an uberjar Pulsar picks up the right class.

  7. david-streamlio commented on Dec 24, 2020

    @david-streamlio
    ContributorAuthor

    Thanks @eolivelli . We should probably document this fact, since it is not well known.

    My goal was to simplify the development of Pulsar IO connectors by allowing developers to bundle multiple "versions" of the same connector that only differ by their input/output schemas. The current implementation requires a separate NAR file for each sink/source pair, which in turn requires a separate project for each sink/source pair.

  8. tisonkun commented on Nov 11, 2022

    @tisonkun
    Member

    Closed as implemented and stale.

    Feel free to create a separate document issue if it's still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/connectorlifecycle/staletype/feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions