Code Monkey home page Code Monkey logo

Comments (3)

StarpTech avatar StarpTech commented on June 15, 2024 1

You can't publish to a specific queue because many subscribers builds a queue group. The publisher is not aware of that. If you have one queue group and many instances (default) the request will be load balanced across all subscribers. If you have a custom queue group with the same topic the request will arrive one instance doesnt matter how much this service is scaled but if you have many different queue groups per add with the same topic the request will load balanced for each group so multiple subscriber will receive that event.

Default: topic = queue-group

add('topic:math,cmd:add')

Worker Queue: If you scale your service the request will receive only one instance. (Doesnt matter whether pubsub or request/reply)

add('topic:math,cmd:add,queue$:test')
add('topic:math,cmd:add,queue$:test')

Custom queue per add: The request will receive at least one time for each custom queue-group

add('topic:math,cmd:add,queue$:test1')
add('topic:math,cmd:add,queue$:test2')

from hemera.

zhaoyao91 avatar zhaoyao91 commented on June 15, 2024

I have had a quick view of the source code, guessing that I may code as below:

// group-1 with many instances
hemera.add({
  $queue: 'group-1'
  topic: 'sth-happened'
}, handler)

// group-2 with many instances
hemera.add({
  $queue: 'group-2'
  topic: 'sth-happened'
}, handler)

hemera.act({
  $pubsub: true,
  topic: 'sth-hanppened'
})

Does this implement what I issued before?

Thanks.

from hemera.

StarpTech avatar StarpTech commented on June 15, 2024

Closed due to inactivity.

from hemera.

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.