crossbario / crossbar

Crossbar.io - WAMP application router
https://crossbar.io/
Other
2.05k stars 275 forks source link

Test coverage for UriObservationMap #1485

Open zzdever opened 5 years ago

zzdever commented 5 years ago

ref: #395

The situation described by @mfojtak still not works.

As for my investigation, I found:

A procedure registered by session.register("com.myapp.funcs.add", add, { match: "prefix" }); can be found by calling session.call('wamp.registration.lookup', ["com.myapp.funcs.add", { match: "prefix" }])

However, two or more procedures with common prefix registered by: session.register("com.myapp.funcs.add1", add1); session.register("com.myapp.funcs.add2", add2); can not be found by calling session.call('wamp.registration.lookup', ["com.myapp.funcs.add", { match: "prefix" }])

I think what @mfojtak described is the second situation.

So, the conclusion is, option { match: "prefix" } in wamp.registration.lookup is for pattern-based registrations, and I have to provide the whole uri to lookup. But this is not for looking up procedures with common prefix. This is a little bit confusing. I reopen this issue for attention.

oberstet commented 5 years ago

However, two or more procedures with common prefix registered by:

This works as designed, as these 2 procs are registered exact, and are different.

Two procedures registered for com.myapp.funcs.add1 and com.myapp.funcs.add2 will lead to 2 different (exact) registrations - those can be found again with wamp.registration.lookup when looking for com.myapp.funcs.add1 or com.myapp.funcs.add2.

A third procedure registered for the prefix com.myapp.funcs.add will lead to a 3rd registration (different from the first 2) which can be found again using com.myapp.funcs.add and { match: "prefix" }.

Now given a concrete URI like com.myapp.funcs.add2, you can check which procedure is best matching via wamp.registration.match.

oberstet commented 5 years ago

IMO, we should take the chance at least to improve 2 things here: