-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added a new text embedded format #858
Conversation
@ppatierno all tests are now passing. |
055fd15
to
6f0d071
Compare
@antonio-pedro99 build is failing on doc with following error ... ERROR: Uncommitted changes in documentation:
M documentation/book/api/paths.adoc
Run the following to add up-to-date resources:
make docu_api \
&& git add documentation/book/ \
&& git commit -s -m 'Update generated documentation' |
|
Just ran on your branch locally the command from Azure pipeline ... mvn -e -V -B -P apidoc io.github.swagger2markup:swagger2markup-maven-plugin:convertSwagger2markup@generate-apidoc and it works like a charm. It produces a |
I need to double-check, it still does not work on my side |
@antonio-pedro99 I have just pushed on your branch with the missing file. Please update your local branch checking out the changes. |
work done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@antonio-pedro99 Thanks for the PR. I wonder how the conversion / error handling works here. I guess it either does not work that well, or it should be documented how does it (not) work.
For example, when I sent a following produce request, where the format is text but the value is JSON, it seems to pass fine:
curl -v -X POST \
192.168.1.220:8080/topics/kafka-test-apps \
-H 'content-type: application/vnd.kafka.text.v2+json' \
-d '{
"records": [
{
"key": "tricky-payload",
"value": {"Ahoj": "Svete"}
}
]
}'
But when I try to consume it, I get empty value:
curl -X GET http://192.168.1.220:8080/consumers/my-bridge-group/instances/my-http-client/records \
-H 'accept: application/vnd.kafka.text.v2+json'
[
{
"topic": "kafka-test-apps",
"key": "tricky-payload",
"value": "",
"partition": 0,
"offset": 69
}
]
This seems to be the issue with the producer here where the bridge decodes the JSON as empty string. When I produce it as JSON and consume as text, I get the more expected "value": "{\"Ahoj\":\"Svete\"}"
. Not sure this is a bug or expected. But if ti is expected, I thik it is worth documenting how to produce the messages.
The response seems to have also a wrong content type application/vnd.kafka.json.v2+json
. That looks like something you have to fix in HttpSink BridgeEndpoint.pollHandler
.
That is a good catch, tbh I am not sure how it is supposed to be handled, I implemented the converter following our discussions on #739. I think it's worth to think about how to handle this case. Allow me some time to think a bit more.
This is fixed in the recent commit. |
src/main/java/io/strimzi/kafka/bridge/http/HttpSinkBridgeEndpoint.java
Outdated
Show resolved
Hide resolved
I think what Jakub found is a bug and the way it should work is that you could produce using an embedded format but receiving with a different one by accepting that there could be some "differences" in what you get. |
I think that works fine in the consumer IIRC what I was trying. It is more what happens the producer with |
Regarding this, because the producer is sending with "text" format and it's a JSON, why and how the bridge should know to validate it's a valid JSON. I mean, it's a plain text. Of course, it can contain a JSON but does it really matter for the bridge? It's just bringing text. |
I guess you can check if the text is empty/null if there are any other
nodes? Anyway, as I said, maybe also just clarifying it in the docs would
be fine.
…On Tue, Jan 2, 2024, 11:57 Paolo Patierno ***@***.***> wrote:
It is more what happens the producer with text format sends a JSON where
we can maybe throw an error or something.
Regarding this, because the producer is sending with "text" format and
it's a JSON, why and how the bridge should know to validate it's a valid
JSON. I mean, it's a plain text. Of course, it can contain a JSON but does
it really matter for the bridge? It's just bringing text.
—
Reply to this email directly, view it on GitHub
<#858 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABLFOR7VP5ZWKDINW7U3ZLTYMPRYXAVCNFSM6AAAAABBFQRUSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTHA3TQNZUHE>
.
You are receiving this because your review was requested.Message ID:
***@***.***>
|
Hey @ppatierno @scholzj, just got busy with some work here. I will get back to you guys over the weekend. |
@antonio-pedro99 are you willing to address this soon? |
Yes , I will! |
Are you planning any release soon? |
No specific plan for now, I was just wondering if you were still interested in it because of 2 weeks after your last comment :-) |
Yeah, I try to complete this on this weekend. |
@antonio-pedro99 any news? |
Not yet :( 😞
It's been hard handling the time. Once there is an update, I'll let you
know.
…On Wed, 31 Jan, 2024, 1:42 pm Paolo Patierno, ***@***.***> wrote:
@antonio-pedro99 <https://github.com/antonio-pedro99> any news?
—
Reply to this email directly, view it on GitHub
<#858 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKFSX3F3KZSFJPAV2VD4JYLYRH4FBAVCNFSM6AAAAABBFQRUSSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJYGU4TGNBWGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
what is consumer IIRC? |
So you suggest validating the JSON and make the possible conversion? If the format is text, it makes more sense to expect |
e590318
to
7b3fa3f
Compare
Looks like the build failed on checkstyle:
Maybe you can have a look if the code can be fixed - if not, you should be able to use |
b009700
to
115c84d
Compare
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Paolo Patierno <[email protected]> Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
This reverts commit b009700. Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: Antonio Pedro <[email protected]>
2dd3965
to
48d136e
Compare
Sorry, might be fixed now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the PR!
@scholzj do you have anything to add?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. But I guess we should have CHANGELOG record for this as well?
Right. @antonio-pedro99 can you add a line in the CHANGELOG about this new feature? |
Signed-off-by: Antonio Pedro <[email protected]>
Signed-off-by: António Pedro <[email protected]>
@scholzj any further comments or can I merge this? |
This fixes #739
Note: I closed #836 and started a fresh PR.