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

Cannot source two streams with the same name from two accounts with flow control #6431

Open
francoisprunier opened this issue Jan 30, 2025 · 0 comments
Labels
defect Suspected defect such as a bug or regression

Comments

@francoisprunier
Copy link

Observed behavior

If I create a stream 'mystreamagg' in account A, that sources stream 'mystream' in account B and stream 'mystream' in account C. Because the streams in account B and accout C have the same name, I cannot configure flow control properly.

A basic config works without flow control works. But because flow control cannot be configured correctly, the sourcing stream can/will be stalled and in practice that means it doesn't work.

Expected behavior

I should be able to configure flow control to work when both streams have the same name. Note that it works if they have different names because the FC subject contain the stream name.

Potential solution to fix it: If I could prefix the FC subjects like I do with the JS API when defining a stream source

{
  "name": "mystreamagg",
 (...)
  "sources": [
    {
      "name": "mystream",
      "external": {
        "api": "JS.B.API",
        "fc": "JS.B.FC",
        "deliver": "deliver.b.mystream"
      }
    },
    {
      "name": "mystream",
      "external": {
        "api": "JS.C.API",
        "fc": "JS.C.FC",
        "deliver": "deliver.c.mystream"
      }
    }
  ],
  (...)
}

then I'd be able to import the FC subjects from both accounts under a different name and it would all work.

Server and client version

Server: 2.10.25
Client: 0.1.6

Host environment

No response

Steps to reproduce

Here's a basic server config:

port: 4222
server_name: my-server
jetstream {
    store_dir="./store_server"
}
accounts {
    SYS: {
        users: [{user: admin, password: admin}]
    },
    A: {
        users: [{user: a, password: pass}],
        jetstream: enabled
        imports: [
            {service: {account: B, subject: "$JS.API.CONSUMER.CREATE.mystream"}, to: "JS.B.API.CONSUMER.CREATE.mystream"}
            {service: {account: C, subject: "$JS.API.CONSUMER.CREATE.mystream"}, to: "JS.C.API.CONSUMER.CREATE.mystream"}
            {stream: {account: B, subject: deliver.b.mystream.>}}
            {stream: {account: C, subject: deliver.c.mystream.>}}
	    # Cannot do the imports below (for good reason)
	    # {service: {account: B, subject: "$JS.FC.mystream.>"}
	    # {service: {account: C, subject: "$JS.FC.mystream.>"}
        ]
    }
    B: {
        users: [{user: b, password: pass}],
        jetstream: enabled
        exports: [
            {service: "$JS.API.CONSUMER.CREATE.mystream", response_type: "stream"}
            {stream: "deliver.b.mystream.>"}
            {service: "$JS.FC.mystream.>"}
        ]
    }
    C: {
        users: [{user: c, password: pass}],
        jetstream: enabled
        exports: [
	    {service: "$JS.API.CONSUMER.CREATE.mystream", response_type: "stream"}
	    {stream: "deliver.c.mystream.>"}
	    {service: "$JS.FC.mystream.>"}
	]
    }
}
system_account: SYS

And the aggregate stream:

{
  "name": "mystreamagg",
  "retention": "limits",
  "max_consumers": -1,
  "max_msgs_per_subject": 0,
  "max_msgs": -1,
  "max_bytes": -1,
  "max_age": 0,
  "max_msg_size": -1,
  "storage": "file",
  "discard": "old",
  "num_replicas": 1,
  "duplicate_window": 120000000000,
  "sources": [
    {
      "name": "mystream",
      "external": {
        "api": "JS.B.API",
        "deliver": "deliver.b.mystream"
      }
    },
    {
      "name": "mystream",
      "external": {
        "api": "JS.C.API",
        "deliver": "deliver.c.mystream"
      }
    }
  ],
  "sealed": false,
  "deny_delete": false,
  "deny_purge": false,
  "allow_rollup_hdrs": false,
  "allow_direct": true,
  "mirror_direct": false,
  "consumer_limits": {}
}

The streams in B and C are just normal streams.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect Suspected defect such as a bug or regression
Projects
None yet
Development

No branches or pull requests

1 participant