Coder Social home page Coder Social logo

Comments (5)

mikoskinen avatar mikoskinen commented on August 23, 2024

I'm starting to wonder if this is more of an issue with the NATS server (or CLI?) and the .NET client is correctly creating the mirror KV.

Command:
nats s view KV_stest-invoices

Seems to list things correctly.

image

Though getting the key from the mirror KV doesn't work:

image

from nats.net.v1.

scottf avatar scottf commented on August 23, 2024

This is an issue with mirroring or filter subjects. I'm not sure how to resolve this yet.

from nats.net.v1.

mikoskinen avatar mikoskinen commented on August 23, 2024

Just a quick addition. Instead of mirroring I tried to use stest as the source for stest-invoices. It is showing identical behaviour:

image

Here's the code:

using var conn = new ConnectionFactory().CreateConnection();

var kvm = conn.CreateKeyValueManagementContext();

var kvName1 = "stest";
var kvName2 = "stest-invoices";

var k1 = new KeyValueConfiguration.KeyValueConfigurationBuilder()
    .WithName(kvName1)
    .Build();

kvm.Create(k1);

var src = new Source.SourceBuilder()
    .WithName(kvName1)
    .WithFilterSubject("$KV.stest.invoice.*")
    .Build();

var k2 = new KeyValueConfiguration.KeyValueConfigurationBuilder()
    .WithName(kvName2)
    .WithSources(src)
    .Build();

kvm.Create(k2);

Here's the stream report:

image

And here's the info for the stest-invoices:

C:\>nats s info KV_stest-invoices
Information for Stream KV_stest-invoices created 2024-03-12 12:56:20

              Replicas: 1
               Storage: File

Options:

             Retention: Limits
       Acknowledgments: true
        Discard Policy: New
      Duplicate Window: 2m0s
     Allows Msg Delete: false
          Allows Purge: true
        Allows Rollups: true

Limits:

      Maximum Messages: unlimited
   Maximum Per Subject: 1
         Maximum Bytes: unlimited
           Maximum Age: unlimited
  Maximum Message Size: unlimited
     Maximum Consumers: unlimited

Replication:

               Sources: KV_stest

Source Information:

           Stream Name: KV_stest
        Subject Filter: $KV.stest.invoice.*
                   Lag: 0
             Last Seen: 147ms

State:

              Messages: 1
                 Bytes: 128 B
        First Sequence: 1 @ 2024-03-12 12:56:30 UTC
         Last Sequence: 1 @ 2024-03-12 12:56:30 UTC
      Active Consumers: 0
    Number of Subjects: 1

from nats.net.v1.

mikoskinen avatar mikoskinen commented on August 23, 2024

Sorry for spamming... As the last idea I tried using "subject transform".

Unfortunately the behavior is the same: bucket reports no keys even though they are in the stream.

image

from nats.net.v1.

scottf avatar scottf commented on August 23, 2024

It's subject filter issue. I used JetStream directly to read the messages.

In the stream for stest

StreamInfo{Created=3/12/2024 5:43:33 PMTimestamp=3/12/2024 5:50:05 PM, StreamConfiguration, Stream:KV_stest | Message Subject: $KV.stest.invoice.500 | Data: invoice
Stream:KV_stest | Message Subject: $KV.stest.inv.500 | Data: inv

In the stream for stest-invoices

DeletedCount=0, FirstTime=3/12/2024 5:43:33 PM, LastTime=3/12/2024 5:43:33 PM}, ClusterInfo=null, NATS.Client.JetStream.MirrorInfo, SourceInfos=}
Stream:KV_stest-invoices | Message Subject: $KV.stest.invoice.500 | Data: invoice

The subject for the message in stest-invoices does not match the subject for a key in that bucket, so any KV operation, either through the cli or the .NET client will never find the key. It needs to be transformed. I'm working on figuring how to do it.

from nats.net.v1.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.