You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for multiple sinks/sources in a single NAR file. #3576
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.
@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.
@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.
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
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.
@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.
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.
Activity
jerrypeng commentedon Feb 12, 2019
@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.
david-streamlio commentedon Feb 12, 2019
@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.yamlWhere 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?
david-streamlio commentedon Feb 12, 2019
@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
david-streamlio commentedon Jul 2, 2019
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.
eolivelli commentedon Dec 24, 2020
@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.
david-streamlio commentedon Dec 24, 2020
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.
tisonkun commentedon Nov 11, 2022
Closed as implemented and stale.
Feel free to create a separate document issue if it's still relevant.