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

Align RePublish with server and add HeadersOnly, also add in AllowDirect option #991

Merged
merged 1 commit into from Jun 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 7 additions & 4 deletions jsm.go
@@ -1,4 +1,4 @@
// Copyright 2021 The NATS Authors
// Copyright 2021-2022 The NATS Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down Expand Up @@ -100,15 +100,18 @@ type StreamConfig struct {
DenyDelete bool `json:"deny_delete,omitempty"`
DenyPurge bool `json:"deny_purge,omitempty"`
AllowRollup bool `json:"allow_rollup_hdrs,omitempty"`
AllowDirect bool `json:"allow_direct,omitempty"`
piotrpio marked this conversation as resolved.
Show resolved Hide resolved

// Allow republish of the message after being sequenced and stored.
RePublish *SubjectMapping `json:"republish,omitempty"`
RePublish *RePublish `json:"republish,omitempty"`
piotrpio marked this conversation as resolved.
Show resolved Hide resolved
}

// SubjectMapping allows a source subject to be mapped to a destination subject for republishing.
type SubjectMapping struct {
// RePublish is for republishing messages once committed to a stream. The original
// subject cis remapped from the subject pattern to the destination pattern.
type RePublish struct {
Source string `json:"src,omitempty"`
Destination string `json:"dest"`
HeadersOnly bool `json:"headers_only,omitempty"`
}

// Placement is used to guide placement of streams in clustered JetStream.
Expand Down
2 changes: 1 addition & 1 deletion test/js_test.go
Expand Up @@ -6956,7 +6956,7 @@ func TestJetStreamRePublish(t *testing.T) {
Name: "RP",
Storage: nats.MemoryStorage,
Subjects: []string{"foo", "bar", "baz"},
RePublish: &nats.SubjectMapping{
RePublish: &nats.RePublish{
Source: ">",
Destination: "RP.>",
},
Expand Down