Skip to content
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

Starting new code for Producer #38

Merged
merged 22 commits into from
Oct 15, 2018
Merged

Conversation

omarlarus
Copy link
Contributor

In order to be more testable and maintainable

@@ -1,8 +1,5 @@
package kafka
Copy link
Member

Choose a reason for hiding this comment

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

org.neo4j.streams.kafka

log.debug("Event with txId ${event.meta.txId} sent successfully")
} catch (e: ProducerFencedException) {
log.error("Error:", e)
producer.close()
Copy link
Member

Choose a reason for hiding this comment

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

what happens if we call producer.close() on the next event?
Will we recover? And how?

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps just abort the tx

producer.commitTransaction()
log.debug("Event with txId ${event.meta.txId} sent successfully")
} catch (e: ProducerFencedException) {
log.error("Error:", e)
Copy link
Member

Choose a reason for hiding this comment

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

Better error messages not just "Error"

log.error("Error:", e)
producer.close()
} catch (e: AuthorizationException) {
log.error("Error:", e)
Copy link
Member

Choose a reason for hiding this comment

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

Auth exception should have happend on initial connect or?

try {
log.debug("Trying to send the event with txId ${event.meta.txId} to kafka")
producer.beginTransaction()
events.forEach {
Copy link
Member

Choose a reason for hiding this comment

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

we should test this with larger amounts of data, e.g. creating 1M nodes and relationships in one tx

UNWIND range(1,100000) as id create (n:Node {id:id, name:"name "+id})-[:REL {since:id}]->(n);
Needs about 3.5G heap for the transaction.

return object : LifecycleAdapter() {

override fun start() {
db.registerTransactionEventHandler(StreamsTransactionEventHandler(StreamsDataEventRouter()))
Copy link
Member

Choose a reason for hiding this comment

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

store the handler in a var and on stop remove it from the listener

import org.apache.kafka.common.internals.Topic
import streams.events.*

object RoutingConfigurationConstants {
Copy link
Member

Choose a reason for hiding this comment

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

passed in from the outside e.g. in the handler for kafka

@@ -25,6 +22,7 @@ class KafkaExtensionFactory : KernelExtensionFactory<KafkaExtensionFactory.Depen

return object : LifecycleAdapter() {
Copy link
Member

Choose a reason for hiding this comment

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

remove the old code

"type": "relationship",
"name": "KNOWS",
"label": "KNOWS",
"before": {
"properties": {
"since": "2018-04-05T12:34:00[Europe/Berlin]"
},
"startNode": {
Copy link
Member

Choose a reason for hiding this comment

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

missed to change "start" and "end" in these files :)

@jexp jexp merged commit a290940 into neo4j-contrib:master Oct 15, 2018
@conker84 conker84 added the LARUS label Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants