Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nats subject mapping does not work with jetstream #3868

Closed
tamalsaha opened this issue Feb 14, 2023 · 6 comments · Fixed by #3887
Closed

nats subject mapping does not work with jetstream #3868

tamalsaha opened this issue Feb 14, 2023 · 6 comments · Fixed by #3887
Assignees

Comments

@tamalsaha
Copy link

Feature Request

I am trying to use NATS subject mapping where the dest subjects are used to create a jetstream. If I send request to the source subjects, I get nats: no responders available for request .

I would expect the jetstream to be able to ACK to the request even when subject mapping is used.

Use Case:

Proposed Change:

Who Benefits From The Change(s)?

Alternative Approaches

@ripienaar
Copy link
Contributor

I use them with JS so best you show us some configs and code

@tamalsaha
Copy link
Author

tamalsaha commented Feb 19, 2023

I followed the steps below using nats-server v2.9.14 .

nats-server -m 8222 -js
nats server mapping "ghactions.runs.*.*" "ghactions.machines.{{wildcard(1)}}.{{partition(3,2)}}"
> nats str create
? Stream Name ghactions
? Subjects ghactions.machines.*.*
? Storage file
? Replication 1
? Retention Policy Work Queue
? Discard Policy Old
? Stream Messages Limit -1
? Per Subject Messages Limit -1
? Total Stream Size -1
? Message TTL -1
? Max Message Size -1
? Duplicate tracking time window 2m0s
? Allow message Roll-ups No
? Allow message deletion Yes
? Allow purging subjects or the entire stream Yes
Stream ghactions was created
> nats request ghactions.runs.queued.1 "I need help!"

07:45:26 Sending request on "ghactions.runs.queued.1"
07:45:26 No responders are available

You can see the error No responders are available

> nats request ghactions.machines.queued.1 "I need help!"
08:00:02 Sending request on "ghactions.machines.queued.1"
08:00:02 Received with rtt 664.917µs
{"stream":"ghactions", "seq":1}

@tamalsaha
Copy link
Author

Related issue: nats-io/natscli#703

@jnmoyne
Copy link
Contributor

jnmoyne commented Feb 20, 2023

nats server mapping does not actually define and set a mapping on your existing running nats-serve(s), it's there only to test mappings.

With Core NATS you define the subject mappings either directly in the server configuration file, or (if you are using operator/JWT-based security) in the account JWT.

However it is most likely that the new/upcoming subject mapping transforms for streams is exactly what you are looking for. It has already been merged in the dev branch, and will be therefore included in the list of new features for NATS 2.10.
(see #3827) which allows you to define a subject mapping transform in the stream definition.

@tamalsaha
Copy link
Author

In that case nats server mapping should be nats server test-mapping so it is clear that this is just client side testing.

@jhaynie
Copy link

jhaynie commented Feb 22, 2023

i just ran into this as well ... lol, spent about 10m until i finally came here and found this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants