Comments (5)
@JoseTomasTocino Postal does not currently support publishing to a wildcard. The wildcards allow you to subscribe to any number of topics being published, but the topics are expected to be specific:
Subscription: model.*.data
Topic Published: model.customer.data
or model.app.data
would both cause the subscription to fire.
Can you explain why you were wanting to use a wildcard in the publication? It might help me or @ifandelse understand so we can point you in the right direction.
from postal.js.
@dcneiner I was writing a blog post about postal.js (you can see it here). In the example I came up with, there's a TheWeatherChannel
where messages about the weather are published. The topics of the messages are, like, Rain.improves
, Wind.stops
, etc. I just wanted to be able to send a message saying that all weather phenomena have stopped, hence the use of *.stop
when publishing.
However, reading your documentation more carefully I found out that I can replace the resolver with my own one that may accept using wildcards when publishing.
from postal.js.
@JoseTomasTocino I can understand why you might want to do something in your given blog post example, but I have not personally needed a wildcard publication in an actual application. But you found out how to accomplish it should you really need to!
Glad to see you writing about publishing and that you are enjoying @elijahmanor 's blog series! He is a great guy!
from postal.js.
@JoseTomasTocino you can certainly implement your own resolver if you want, but I'd encourage you to rethink the need to publish a wildcard. The point of this kind of messaging is to allow subscribers to indicate the specific messages in which they are interested. By allowing the publisher to dictate which subscribers receive a message - instead of simply letting the subscribers handle that on their own via their subscriptions - you are introducing a subtle but eventually-dangerous form brittle-ness into your application that can be solved in a different (and better, IMO) way. If you need to publish a message indicating that all weather phenomena have stopped, I would make that it's own message. You can still have topics like Rain.improves
, Wind.stops
, etc., but that doesn't preclude you from having Weather.stop
. In fact, if Weather.stop
and rain.stop
are published on the same channel, your subscriber need only subscribe to *.stop
. The key here is to try and model the real nature of what's going on: the rain stopping, and ALL weather phenomena stopping are truly two distinct events, and should get their own message. I hope that's helpful! Good luck!
from postal.js.
Thanks for your comments guys! They've been really helpful.
from postal.js.
Related Issues (20)
- How to publish data between Node.js modules? HOT 2
- Bower Release v2.0.5
- Competing consumers HOT 1
- Help improve the quality of the DefinitelyTyped (TypeScript) definitions
- postal.preserve: Still taking a ConduitJS dependency HOT 2
- Default Subscriber
- Stack overflow in IE 11 when publish called on channel with many pending unsubscribes
- Shouldn't postal.channel() implement the Singleton pattern? HOT 2
- Subscriber callback method can brake calling other subscribers HOT 1
- Devtools extension for Chrome
- Messages published inside a subscriber won't be passed to uncached subscribers
- why cache only for result === true
- postal.lodash.js Error: Module name "lodash/after" has not been loaded
- Is this project still active? HOT 6
- Wait for messages to be delivered and processed in unit tests
- timeStamp in envelope should honor timezone
- Timestamp missing on wireTap envelopes
- Thank you
- Regarding publish and subscribe, Important question
- How does postal.js support replay?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from postal.js.