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

Throw an exception when the BatchWriter fails on a write operation #51

Closed
sastafford opened this issue Feb 18, 2017 · 3 comments
Closed
Milestone

Comments

@sastafford
Copy link
Contributor

As a developer
I want to TITLE
So that I can handle the exception appropriately and continue to write the next batch.

I have ran into a Batch error where I have a conflicting update error (the batch of documents have two docs with the same URI). Unfortunately it causes the whole program to crash. I would like to take note and log the error but I would like the program to continue.

I believe it is just adding a throws statement on the BatchWriter.write() method.

@sastafford
Copy link
Contributor Author

Looking into this a bit more, one option would be to create a try/catch in RestBatchWriter. I'm approaching this from MarkLogicItemWriter using this service. Who should handle the exception?

@rjrudin
Copy link
Contributor

rjrudin commented Feb 19, 2017

I think a Listener interface is appropriate here. I thought that ThreadPoolTaskExecutor had such a thing - it does, but it requires attaching a FailureCallback to the ListenableFuture that's returned. Since subclasses of BatchWriterSupport aren't guaranteed to be doing async writes, I think a listener interface is appropriate here.

@rjrudin
Copy link
Contributor

rjrudin commented Feb 19, 2017

@sastafford How does this look?

b0d59cf

I don't think anything is needed when a non-async TaskExecutor is used, as the client can just use a try/catch itself.

@rjrudin rjrudin added this to the 2.13.0 milestone Feb 22, 2017
@rjrudin rjrudin closed this as completed Feb 22, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants