Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
histhub
linker
Commits
f35bfe58
Commit
f35bfe58
authored
Jun 19, 2018
by
Tobias Steiner
Browse files
Managing backpressure
parent
215ff526
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/index.ts
View file @
f35bfe58
...
...
@@ -31,10 +31,7 @@ kafka.init().then(() => {
/**
* Get next from kafka
*/
const
next
=
()
=>
{
// start consuming
consumer
.
consume
(
1
);
};
consumer
.
consume
();
/**
* On data, write stuff to neo4j
...
...
@@ -47,14 +44,15 @@ kafka.init().then(() => {
// todo: we need to profile this error
// https://stackoverflow.com/questions/30403504/neo4j-merge-performance-vs-create-set
linker
.
connect
(
rawData
.
parsed
).
then
(()
=>
{
next
();
},
(
error
)
=>
{
core
.
getLogger
().
error
(
'
Could not save data to neo4j
'
+
JSON
.
stringify
(
error
));
throw
error
;
// next();
consumer
.
disconnect
();
setTimeout
(()
=>
{
consumer
.
connect
();
consumer
.
consume
();
},
1000
);
});
});
next
();
});
},
(
err
)
=>
{
core
.
getLogger
().
error
(
'
Error while connecting to kafka
'
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment