Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Added …Inlet.create Java API for errorHandler.#1066

Merged
RayRoestenburg merged 1 commit into
mainfrom
java_proto_inlet_error_handler
Jun 15, 2021
Merged

Added …Inlet.create Java API for errorHandler.#1066
RayRoestenburg merged 1 commit into
mainfrom
java_proto_inlet_error_handler

Conversation

@RayRoestenburg

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Added Java API for ProtoInlet and AvroInlet, for errorHandler.

errorHandler: (Array[Byte], Throwable) => Optional[T]): AvroInlet[T] =
AvroInlet[T](name, hasUniqueGroupId, (a, t) => {
val opt = errorHandler(a, t)
if (opt.isPresent) Some(opt.get()) else None

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.

Isn't this same as returning the opt itself ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's calling the Scala constructor which needs Option, not Optional

errorHandler: (Array[Byte], Throwable) => Optional[T]): ProtoInlet[T] =
ProtoInlet[T](name, clazz, hasUniqueGroupId, (a, t) => {
val opt = errorHandler(a, t)
if (opt.isPresent) Some(opt.get()) else None

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.

Isn't this same as returning the opt itself ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh no, wait, actually this is converted to the Scala API. The constructor takes Option, not Optional.

@debasishg debasishg 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.

a minor suggestion .. otherwise LGTM

@RayRoestenburg RayRoestenburg merged commit d1d5685 into main Jun 15, 2021
@RayRoestenburg RayRoestenburg deleted the java_proto_inlet_error_handler branch June 15, 2021 12:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants