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

The protobuf-c and ssh libraries are looked for when using the cnats static library. #678

Closed
li1786422 opened this issue Aug 31, 2023 · 16 comments
Assignees
Labels
defect Suspected defect such as a bug or regression

Comments

@li1786422
Copy link

What version were you using?

natsclient 3.61

What environment was the server running in?

Static libraries generated by vs code cmake on windows using the visio studio 2022 compiler (for x64 architectures).

Is this defect reproducible?

When using the cnats static library, the link will look for protobuf-c libraries, and when generating the cnats library, the static library of protobuf-c is used.

Given the capability you are leveraging, describe your expectation?

Use the cnats library without relying on any other libraries.

Given the expectation, what is the defect you are observing?

Problems with static library generation mechanism under windows or cmake writing

@li1786422 li1786422 added the defect Suspected defect such as a bug or regression label Aug 31, 2023
@levb levb self-assigned this Aug 31, 2023
@levb
Copy link
Collaborator

levb commented Aug 31, 2023

@li1786422 Are you observing this when linking the example apps? There was a recent conversation about it in the #C channel on Slack.

A quick workaround could be: if you are not using the now-deprecated NATS Streaming (aka STAN), you can compile with -DNATS_BUILD_STREAMING=OFF. STAN is the only part of the code that has a libprotobuf-c dependency.

@levb
Copy link
Collaborator

levb commented Oct 17, 2023

@li1786422 Did my suggestion above work for you?

@li1786422
Copy link
Author

ok I will try it

@li1786422
Copy link
Author

but jetstream also use libprotobuf-c to encode

@li1786422
Copy link
Author

please nat-c have the ues of key-value example?

@kozlovic
Copy link
Member

but jetstream also use libprotobuf-c to encode

@li1786422 No, JetStream does not need libprotobuf-c, the protocols are JSON.

key-value example?

We don't have examples per-se, but you could have a look at the tests, this should give you all the help you need. Check tests that start with test_KeyValue:

@li1786422
Copy link
Author

ok

@li1786422
Copy link
Author

Is it possible to set the lifetime of a message on jetstream, I only found a MaxAge in the jetStreamConfig but I don't know if it's relevant.

@kozlovic
Copy link
Member

@li1786422 No, you cannot set a TTL per-message. It is only at the stream level.

@li1786422
Copy link
Author

@li1786422 No, you cannot set a TTL per-message. It is only at the stream level.
Please
set the survival of a message to be limited only from MaxMsgSize, jsDiscardPolicy?and What is the meaning of MaxAge in jetStreamConfig, is it in years, months, days or seconds?

@kozlovic
Copy link
Member

@li1786422 You will find more information about the stream configuration here. MaxAge is the time to live of messages in the stream expressed in nanoseconds (this comes from Go time.Duration that is an int64 and the unit is nanoseconds).

@li1786422
Copy link
Author

Thanks Sorry I only looked in the source code and didn't find that explanation.

@li1786422您可以在此处找到有关流配置的更多信息。MaxAge 是流中消息的生存时间,以纳秒表示(这来自 Go time.Duration,是一个 int64,单位是纳秒)。
Thanks Sorry I only looked in the source code and didn't find that explanation.

@li1786422
Copy link
Author

li1786422 commented Oct 25, 2023

Please use js_SubscribeSync(&sub, js, subj, &jsOpts, NULL, NULL); to subscribe to a topic, and after that subscribe to a topic by while(1){
natsSubscription_NextMsg(&msg, sub, 5000);
if (s ! = NATS_OK)
break;

        if (start == 0)
        start = nats_Now(); s = natsMsg_NextMsg(sub, 5000); 
       if (s ! = NATS_OK)
        sleep(1)//sleep 1 seconds this is pseudocode
        s = natsMsg_Ack(msg, nullptr);
        The method natsMsg_Destroy(msg);

}
keeps printing the data, what is the reason for the garbled order of the fetched data
When the client pulls data, how to ensure the correct order of the data when it stays for a while and then pulls the data?

@kozlovic
Copy link
Member

@li1786422 I am not sure I understand your question. Are you saying that messages "1, 2, 3, 4, 5" are in the stream and using the code above you don't see messages "1, 2, 3, 4, 5" being received? We would need to see the content of the subscribe options to see for instance if you have created a queue (and have multiple instances running) instead of a regular consumer, or if you have a MaxAckWait that is way too small (smaller than your sleep interval) that then causes the server to redeliver messages.

Also, I would prefer that either we close this issue (related to CMake) if the original problem is somehow addressed and that you open new issues when dealing with different questions/issues. Is that ok?

@li1786422
Copy link
Author

li1786422 commented Oct 26, 2023

@li1786422 I am not sure I understand your question. Are you saying that messages "1, 2, 3, 4, 5" are in the stream and using the code above you don't see messages "1, 2, 3, 4, 5" being received? We would need to see the content of the subscribe options to see for instance if you have created a queue (and have multiple instances running) instead of a regular consumer, or if you have a MaxAckWait that is way too small (smaller than your sleep interval) that then causes the server to redeliver messages.

Also, I would prefer that either we close this issue (related to CMake) if the original problem is somehow addressed and that you open new issues when dealing with different questions/issues. Is that ok?
this question I have commited ,The issue is Subscription Data Disorder Problem #690
Please help me with the answer thanks

@levb
Copy link
Collaborator

levb commented Oct 26, 2023

Closing since the original issue is resolved, and the new ticket filed

@levb levb closed this as completed Oct 26, 2023
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

3 participants