Skip to content

[feat][io] Provide a HTTP Sink - #17581

Merged
cbornet merged 1 commit into
apache:masterfrom
cbornet:http-sink
Oct 27, 2022
Merged

cbornet merged 1 commit into
apache:masterfrom
cbornet:http-sink

Conversation

@cbornet

@cbornet cbornet commented Sep 10, 2022 •

Copy link
Copy Markdown
Contributor

Motivation

The HTTP Sink pushes records to any HTTP server with the record value in the body of POST method.
It means you can have event push notification to a simple webhook. This enables the number of applications and platforms to integrate with Pulsar in an existing architecture without Pulsar’s library dependencies and constraints of OS and language that current Pulsar clients can only support.

The Sink takes inspiration from Pulsar Beam and the Confluent HTTP Sink connector.

The body of the HTTP request is the JSON representation of the record value.
Some headers are added to the HTTP request:

  • PulsarTopic: the topic of the record
  • PulsarKey: the key of the record
  • PulsarEventTime: the event time of the record
  • PulsarPublishTime: the publish time of the record
  • PulsarMessageId: the ID of the message contained in the record
  • PulsarProperties-*: each record property is passed with the property name prefixed by PulsarProperties-

Modifications

trivial

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • Run HttpSinkTest tests

Does this pull request potentially affect one of the following parts:

no

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • Anything that affects deployment

Documentation

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

Matching PR in forked repository

PR in forked repository: cbornet#5

@github-actions github-actions Bot added the doc-required Your PR changes impact docs and you will update later. label Sep 10, 2022
@cbornet cbornet changed the title Provide an HTTP Sink [feature][connectors] Provide an HTTP Sink Sep 10, 2022
@cbornet cbornet changed the title [feature][connectors] Provide an HTTP Sink [feature][connectors] Provide a HTTP Sink Sep 11, 2022
@cbornet

cbornet commented Sep 11, 2022

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@cbornet cbornet closed this Sep 11, 2022
@cbornet cbornet reopened this Sep 11, 2022
@cbornet cbornet closed this Sep 11, 2022
@cbornet cbornet reopened this Sep 11, 2022
@cbornet
cbornet force-pushed the http-sink branch 2 times, most recently from 6d6d2cf to 7aa8d84 Compare September 12, 2022 21:20
Comment thread pulsar-io/http/pom.xml Resolved

@hezhangjian hezhangjian left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better to add new line on the end of .java file

@cbornet

cbornet commented Sep 13, 2022

Copy link
Copy Markdown
Contributor Author

better to add new line on the end of .java file

done. PTAL.
Maybe this could be enforced on checkstyle ?

@cbornet

cbornet commented Sep 14, 2022

Copy link
Copy Markdown
Contributor Author

/pulsarbot run-failure-checks

@codelipenghui codelipenghui left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @cbornet thanks for the contribution
We should start with a proposal since it's a new connector will introduced to Pulsar repo.
And is it possible to move the pulsar-adapters?

@cbornet

cbornet commented Sep 14, 2022

Copy link
Copy Markdown
Contributor Author

Sure, I'll write a PIP.

And is it possible to move the pulsar-adapters?

I'm not sure pulsar-adapters is the good place if we don't move the other connectors.

@cbornet

cbornet commented Sep 23, 2022

Copy link
Copy Markdown
Contributor Author

Implements PIP-208: HTTP Sink

@github-actions

Copy link
Copy Markdown

The pr had no activity for 30 days, mark with Stale label.

@cbornet cbornet removed the Stale label Oct 26, 2022
@cbornet
cbornet requested a review from codelipenghui October 26, 2022 14:44
@cbornet cbornet changed the title [feature][connectors] Provide a HTTP Sink [feat][io] Provide a HTTP Sink Oct 26, 2022

@eolivelli eolivelli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

LGTM

@codecov-commenter

codecov-commenter commented Oct 27, 2022 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 48.48485% with 85 lines in your changes missing coverage. Please review.
✅ Project coverage is 45.96%. Comparing base (6c65ca0) to head (a26b0a1).
⚠️ Report is 3526 commits behind head on master.

Files with missing lines Patch % Lines
.../java/org/apache/pulsar/io/http/JsonConverter.java 32.11% 69 Missing and 5 partials ⚠️
.../main/java/org/apache/pulsar/io/http/HttpSink.java 82.97% 3 Missing and 5 partials ⚠️
...java/org/apache/pulsar/io/http/HttpSinkConfig.java 66.66% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #17581       +/-   ##
=============================================
+ Coverage     34.91%   45.96%   +11.05%     
- Complexity     5707    17715    +12008     
=============================================
  Files           607     1582      +975     
  Lines         53396   128874    +75478     
  Branches       5712    14174     +8462     
=============================================
+ Hits          18644    59240    +40596     
- Misses        32119    63544    +31425     
- Partials       2633     6090     +3457     
Flag Coverage Δ
unittests 45.96% <48.48%> (+11.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...java/org/apache/pulsar/io/http/HttpSinkConfig.java 66.66% <66.66%> (ø)
.../main/java/org/apache/pulsar/io/http/HttpSink.java 82.97% <82.97%> (ø)
.../java/org/apache/pulsar/io/http/JsonConverter.java 32.11% <32.11%> (ø)

... and 1176 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cbornet
cbornet merged commit b193051 into apache:master Oct 27, 2022
@cbornet
cbornet deleted the http-sink branch October 27, 2022 18:06
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Oct 28, 2022
(cherry picked from commit b193051)

Cherry pick and:
* Add the docker image 'all'
* Set source compatibility to JDK11 for the new sink
@momo-jun

momo-jun commented Nov 7, 2022

Copy link
Copy Markdown
Contributor

@cbornet It will help users a lot if you can add the docs for this feature. Do you have any planned updates on that?

@Technoboy- Technoboy- added this to the 2.12.0 milestone Nov 7, 2022
Technoboy- pushed a commit that referenced this pull request Nov 14, 2022
@Technoboy- Technoboy- modified the milestones: 2.12.0, 2.11.0 Nov 14, 2022
@cbornet cbornet mentioned this pull request Nov 23, 2022
@cbornet

cbornet commented Nov 24, 2022

Copy link
Copy Markdown
Contributor Author

@momo-jun see #18582 for the doc

@momo-jun momo-jun added doc-complete Your PR changes impact docs and the related docs have been already added. and removed doc-required Your PR changes impact docs and you will update later. labels Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/branch-2.11 doc-complete Your PR changes impact docs and the related docs have been already added. ready-to-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants