{"action":"created","issue":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/6128","repository_url":"https://api.github.com/repos/rethinkdb/rethinkdb","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/6128/labels{/name}","comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/6128/comments","events_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/6128/events","html_url":"https://github.com/rethinkdb/rethinkdb/issues/6128","id":180164423,"number":6128,"title":"How to guarantee delivery with changefeeds","user":{"login":"arekkas","id":3372410,"avatar_url":"https://avatars.githubusercontent.com/u/3372410?v=3","gravatar_id":"","url":"https://api.github.com/users/arekkas","html_url":"https://github.com/arekkas","followers_url":"https://api.github.com/users/arekkas/followers","following_url":"https://api.github.com/users/arekkas/following{/other_user}","gists_url":"https://api.github.com/users/arekkas/gists{/gist_id}","starred_url":"https://api.github.com/users/arekkas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arekkas/subscriptions","organizations_url":"https://api.github.com/users/arekkas/orgs","repos_url":"https://api.github.com/users/arekkas/repos","events_url":"https://api.github.com/users/arekkas/events{/privacy}","received_events_url":"https://api.github.com/users/arekkas/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-09-29T21:12:33Z","updated_at":"2016-10-13T23:49:12Z","closed_at":null,"body":"Upon reading through the docs, I stumbled upon the *Scaling considerations* section on [the changefeed page](https://www.rethinkdb.com/docs/changefeeds/javascript/):\r\n\r\n> Since changefeeds are unidirectional with no acknowledgement returned from clients, they cannot guarantee delivery. If you need real-time updating with delivery guarantees, consider using a model that distributes to the clients through a message broker such as [RabbitMQ](https://www.rethinkdb.com/docs/rabbitmq/javascript/).\r\n\r\nThe RabbitMQ link forwarded me to the [RabbitMQ integration page](https://www.rethinkdb.com/docs/rabbitmq/javascript/). There I noticed, that this example script (let's call it adapter script) is also using changefeeds:\r\n\r\n> RethinkDB supports changefeeds, which allow you to subscribe to changes on a table. The database pushes these changes to you as they happen. This opens up the possibility of notifying client applications immediately when a change occurs in a table. For real-time applications, this push behavior is essential. RabbitMQ is a natural choice for distributing notifications of change events. [...]\r\n\r\nAnd the concrete example taken from the docs:\r\n\r\n```js\r\nvar tableChanges = r.db('change_example').table('mytable').changes();\r\npromise = promise.then(function(){\r\n    return tableChanges.run(rethinkConn);\r\n}).then(function(changeCursor){\r\n    changeCursor.each(function(err, change){\r\n        var routingKey = 'mytable.' + typeOfChange(change);\r\n        var payload = new Buffer(JSON.stringify(change));\r\n        channel.publish('rethinkdb', routingKey, payload);\r\n    })\r\n})\r\n```\r\n\r\nHowever, this will only guarantee delivery of messages that actually arrived at the adapter script. I might have reduced the amount of errors that can occur by reducing the amount of listeners on rethinkdb, but [the network is still not reliable](https://en.wikipedia.org/wiki/Fallacies_of_distributed_computing) and there will still be messages that will not get delivered, despite of RabbitMQ.\r\n\r\nSo, how is it possible to have a guarantee of delivery with rethinkdb?"},"comment":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/comments/253672330","html_url":"https://github.com/rethinkdb/rethinkdb/issues/6128#issuecomment-253672330","issue_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/6128","id":253672330,"user":{"login":"1lann","id":804919,"avatar_url":"https://avatars.githubusercontent.com/u/804919?v=3","gravatar_id":"","url":"https://api.github.com/users/1lann","html_url":"https://github.com/1lann","followers_url":"https://api.github.com/users/1lann/followers","following_url":"https://api.github.com/users/1lann/following{/other_user}","gists_url":"https://api.github.com/users/1lann/gists{/gist_id}","starred_url":"https://api.github.com/users/1lann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/1lann/subscriptions","organizations_url":"https://api.github.com/users/1lann/orgs","repos_url":"https://api.github.com/users/1lann/repos","events_url":"https://api.github.com/users/1lann/events{/privacy}","received_events_url":"https://api.github.com/users/1lann/received_events","type":"User","site_admin":false},"created_at":"2016-10-13T23:49:12Z","updated_at":"2016-10-13T23:49:12Z","body":"I would just like to mention that this: https://github.com/rethinkdb/rethinkdb/issues/3471 may allow for the reliable changefeeds you want, but there will be a delay to recover the changefeed if a network error occurs."}}
{"actor":{"display_login":"1lann"}}