Giter Site home page Giter Site logo

Comments (5)

dcneiner avatar dcneiner commented on July 19, 2024

@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.

JoseTomasTocino avatar JoseTomasTocino commented on July 19, 2024

@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.

dcneiner avatar dcneiner commented on July 19, 2024

@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.

ifandelse avatar ifandelse commented on July 19, 2024

@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.

JoseTomasTocino avatar JoseTomasTocino commented on July 19, 2024

Thanks for your comments guys! They've been really helpful.

from postal.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.