2

In config file if we use specific subscription, it shows error. But if we use wildcard '>' then it is running with no issue.

Config File with Desire Subscription for user vizzio and test :

authorization: {
users: [
    { user: aquila, password: $2a$12$9TasTI2C08RXkDs/EsZSIOaPDn.oKBcoNpsz71zY1bVXGSIhfjrQS, permissions: { publish: { deny: ">" }, 
      subscribe: "nats.service.aquila.>", allow_responses: true}},
      
    { user: vizzio, password: $2a$12$2vFQ3Buqy8i4DNhRoTjJ7ui3njVwDPSnZK2Oi/zLfjMxibOQIuKcS, permissions: { publish: "nats.service.aquila.>", 
      subscribe: "nats.service.aquila.>"}},
    
    { user: test, password: $2a$12$tjLLKZgO9JR.tyk.BhperOt8F82xrDJ9fjcOnJEO/5QHXX7OlSz2e, permissions:   { publish: "nats.service.aquila.vehicle.>",
      subscribe: "nats.service.aquila.vehicle.>"}}
]

}

Here aquila user received request and replied but vizzio user cannot show responded acknowledgement.

On the other hand if I use wildcard '>' for subscription then it works fine.

Config with wildcard '>' for user vizzio and test

authorization: {
users: [
    { user: aquila, password: $2a$12$9TasTI2C08RXkDs/EsZSIOaPDn.oKBcoNpsz71zY1bVXGSIhfjrQS, permissions: { publish: { deny: ">" }, 
      subscribe: "nats.service.aquila.>", allow_responses: true}},
      
    { user: vizzio, password: $2a$12$2vFQ3Buqy8i4DNhRoTjJ7ui3njVwDPSnZK2Oi/zLfjMxibOQIuKcS, permissions: { publish: "nats.service.aquila.>", 
      subscribe: ">"}},
    
    { user: test, password: $2a$12$tjLLKZgO9JR.tyk.BhperOt8F82xrDJ9fjcOnJEO/5QHXX7OlSz2e, permissions:   { publish: "nats.service.aquila.vehicle.>",
      subscribe: ">"}}
]

}

But subscribe nats.service.aquila.> for vizzio user and nats.service.aquila.vehicle.> for test user should also work but not working.

Reza
  • 21
  • 2

1 Answers1

0

You need to have subscribe = "_INBOX.>" (i.e. instead of subscribe: "nats.service.aquila.>" since it doesn't need to subscribe to its own requests) for your user vizzio so that it can receive the replies to it's requests.

For reference on how Request-reply works on NATS: the client subscribes to a unique INBOX subject and publishes it's request on the subject, the server subscribes to that subject (in practice a bunch of servers subscribe to that subject using a queue-group) and publishes the reply on the INBOX subject that was attached to the request.

JNM
  • 221
  • 2
  • 5