Skip to content
This repository has been archived by the owner on Oct 17, 2023. It is now read-only.

(Phase 1) Multi namespace support #101

Merged
merged 4 commits into from
Jul 27, 2015
Merged

(Phase 1) Multi namespace support #101

merged 4 commits into from
Jul 27, 2015

Conversation

jipperinbham
Copy link
Contributor

Addresses #78 based on implementation discussed in #23

The following allows for processing more than 1 collection/table at a time. The current Source adaptors, MongoDB and RethinkDB, have been updated to properly handle this change but the RethinkDB adaptor does NOT automagically pick up new tables added to the database.

An example of how one could pick and choose what namespaces they wanted to sync:

pipeline = Source({name:"foofile", namespace: "database./(bas|baz)/"})

pipeline.save({name:"localmongo", namespace: "boom.bas"})
pipeline.save({name:"locales", namespace: "boom.baz"})

You can also create transformers in the pipeline which have access to the namespace if you need to alert it inflight.

@jipperinbham
Copy link
Contributor Author

@alindeman if you can, could you take a look at the RethinkDB changes?

@@ -65,7 +66,7 @@ func NewPipe(pipe *Pipe, path string) *Pipe {
// Listen starts a listening loop that pulls messages from the In chan, applies fn(msg), a `func(message.Msg) error`, and emits them on the Out channel.
// Errors will be emited to the Pipe's Err chan, and will terminate the loop.
// The listening loop can be interupted by calls to Stop().
func (m *Pipe) Listen(fn func(*message.Msg) (*message.Msg, error)) error {
func (m *Pipe) Listen(nsFilter *regexp.Regexp, fn func(*message.Msg) (*message.Msg, error)) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

i probably would flip the args here..
p.Listen(fn, rx)
(sorry)

@alindeman
Copy link
Contributor

LGTM

@nstott
Copy link
Contributor

nstott commented Jul 22, 2015

looks good,
i do think that it would make sense to have a namespace type that serves as a container for all the common operations, it would enforce a bit of consistency in how we handled the regexes

we can save that refactor for later though if you want to merge now

@nstott nstott mentioned this pull request Jul 22, 2015
@jipperinbham
Copy link
Contributor Author

I reversed the params to Listen but left the Namespace refactor for the next PR.

jipperinbham added a commit that referenced this pull request Jul 27, 2015
(Phase 1) Multi namespace support
@jipperinbham jipperinbham merged commit 69c9c3b into master Jul 27, 2015
@jipperinbham jipperinbham deleted the multi-namespace branch July 27, 2015 01:44
This was referenced Jul 27, 2015
@jipperinbham jipperinbham added this to the v0.1.0 milestone Jul 27, 2015
@Alino
Copy link
Contributor

Alino commented Jul 28, 2015

I am trying to use this multi namespace but i got some error:

application.js

pipeline = Source({name:"localmongo", namespace:"admin./(eshops|masterProducts|masterCategories)/"})
pipeline.save({name:"es", namespace:"admin.eshops"})
pipeline.save({name:"es", namespace:"admin.masterProducts"})
pipeline.save({name:"es", namespace:"admin.masterCategories"})

the error:
Mongo Config {URI:mongodb://192.168.59.103/admin:27017 Namespace:admin./(eshops|masterProducts|masterCategories)/ Ssl: Timeout: Debug:true Tail:false Wc:0 FSync:false Bulk:false}
setting start timestamp: 6176528679523319808
transporter: CRITICAL: elasticsearch error (Bulk Insertion Error. Failed item count [24])
transporter: CRITICAL: elasticsearch error (Bulk Insertion Error. Failed item count [27])
transporter: CRITICAL: elasticsearch error (Bulk Insertion Error. Failed item count [19])
transporter: CRITICAL: elasticsearch error (Bulk Insertion Error. Failed item count [23])
transporter: CRITICAL: elasticsearch error (Bulk Insertion Error. Failed item count [25])
transporter: CRITICAL: elasticsearch error (Bulk Insertion Error. Failed item count [22])
transporter: CRITICAL: elasticsearch error (Bulk Insertion Error. Failed item count [28])
transporter: CRITICAL: elasticsearch error (Bulk Insertion Error. Failed item count [22])
transporter: CRITICAL: elasticsearch error (Bulk Insertion Error. Failed item count [26])
transporter: CRITICAL: elasticsearch error (Bulk Insertion Error. Failed item count [24])
transporter: CRITICAL: elasticsearch error (Bulk Insertion Error. Failed item count [6])

@jipperinbham
Copy link
Contributor Author

@Alino I've just pushed what I believe is a fix for this, c6ab007

Would you mind testing on your end?

@Alino
Copy link
Contributor

Alino commented Jul 28, 2015

@jipperinbham I can confirm that your fix works, thank you very much!

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.

4 participants