-
Notifications
You must be signed in to change notification settings - Fork 45
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
setElementConverter for HttpSinkRequestEntry is deprecated ,what is alternate method or code we need to use #61
Comments
Hi,
The info you are looking for is included in java dock of the deprecated method I see that README and the examples were not updated... sorry :) I've created an issue for this: |
The What you can do is implement the interface and pass its instance or use anonymous class like so:
The |
Thank @kristoffSC for suggestion, i have tried it out getting serialization issue Caused by: org.apache.flink.streaming.runtime.tasks.StreamTaskException: Could not serialize object for key serializedUDF. Exception in thread "main" org.apache.flink.util.FlinkRuntimeException: Error in serialization. |
Hi @someshwar1 Please post a job example that reproduce this issue so we could narrow it down. |
found issue
|
Glad that worked, seems like straightforward Java <-> Flink case :)
This will work but your "new inner class" must be declared static. If its not Also if you use a reference to static Anonymous class this will also work if defined in the same class. Anyways the options are:
Ad 1:
This will also work:
and those will not work, causing serialization exception:
|
@deprecated
@PublicEvolving
public HttpSinkBuilder setElementConverter(ElementConverter<InputT, HttpSinkRequestEntry> elementConverter) {
this.elementConverter = elementConverter;
return this;
}
code :
HttpSink.builder()
.setEndpointUrl("http://example.com/myendpoint")
.setElementConverter(
(s, _context) -> new HttpSinkRequestEntry("POST", s.getBytes(StandardCharsets.UTF_8)))
.setProperty("gid.connector.http.sink.header.X-Content-Type-Options", "nosniff")
.build();
The text was updated successfully, but these errors were encountered: