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 #703

Closed
tamalsaha opened this issue Feb 13, 2023 · 3 comments
Closed

nats subject mapping does not work #703

tamalsaha opened this issue Feb 13, 2023 · 3 comments
Assignees

Comments

@tamalsaha
Copy link
Contributor

I think I have found a bug in nats subject mapping.

nats server mapping "ghactions.runs.*.*.*.*" "ghactions.machines.{{wildcard(1)}}.{{wildcard(2)}}.{{partition(3,3,4)}}"

nats: error: invalid mapping destination: not using all of the token wildcard(s) in ghactions.machines.{{wildcard(1)}}.{{wildcard(2)}}.{{partition(3,3,4)}}

This should not cause error.

Also, why it is an issue, if I don't want to use all the wildcards in the dest subj?

@ripienaar
Copy link
Collaborator

I am not sure tbh maybe @jnmoyne knows

@MauriceVanVeen
Copy link
Contributor

Seems to be an issue at the server-side.

Specifically in the newTransform function, where it throws this error:

if nphs < npwcs {
        // not all wildcards are being used in the destination
	return nil, &mappingDestinationErr{dest, ErrMappingDestinationNotUsingAllWildcards}
}

The {{partition(3,3,4)}} combines two wildcards, but the code in that function does a nphs++, counting the combination of two wildcards in the partition as only one?

@jnmoyne
Copy link
Contributor

jnmoyne commented Feb 20, 2023

Currently subject mapping transforms still abide by the rule of "MUST be using all of the partial wildcard tokens defined in the transform's source", which many people have asked about (wanting for that restriction to be removed).

The particular mapping in question should now work once nats-io/nats-server#3887 gets merged in, but I am still working on the relaxing of the overall rule of "must be using all tokens" and will keep this open (unless you want to create an issue specifically about transforms not needing to use all of the partial wildcard tokens in the source in the nats-server repo).

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

No branches or pull requests

4 participants