Skip to content

Commit

Permalink
Merge pull request #991 from nats-io/republish_allow_direct
Browse files Browse the repository at this point in the history
Align RePublish with server and add HeadersOnly, also add in AllowDirect option
  • Loading branch information
derekcollison committed Jun 7, 2022
2 parents 8015437 + c5ad6a4 commit 93d66a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
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"`

// Allow republish of the message after being sequenced and stored.
RePublish *SubjectMapping `json:"republish,omitempty"`
RePublish *RePublish `json:"republish,omitempty"`
}

// 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 @@ -7060,7 +7060,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

0 comments on commit 93d66a3

Please sign in to comment.