-
Notifications
You must be signed in to change notification settings - Fork 139
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
Subscription Data Disorder Problem #690
Comments
When I remove sleep, after getting data up to 1000 data it pauses for a while before going to start the subscription from the beginning, where the 1000 data are in order |
@li1786422 Apologies if I am misunderstanding your issue, but it seems to me that you want your stream configured with a Please let me know if I misunderstood the issue. |
subscribe code : Scenario 1 running result: from subscribe.txt . I found that the data I obtained after hellofoo1_1459 becomes hellofoo1_460 and the data after that is disordered Scenario 2 I did debugging and found that js_PullSubscribe is successful but natsSubscription_Fetch doesn't fetch the data, I don't understand why that is my nats-server configuration file : |
@li1786422 Thank you for providing the code snippets, they should help to understand/fix the issue. Unfortunately they seem to be encoded and I can't see them when downloaded. Do you mind pasting in the ticket or using https://gist.github.com/? |
this is not encode ,you can try : subscribe code : Scenario 1 running result: from subscribe.txt . I found that the data I obtained after hellofoo1_1459 becomes hellofoo1_460 and the data after that is disordered Scenario 2 I did debugging and found that js_PullSubscribe is successful but natsSubscription_Fetch doesn't fetch the data, I don't understand why that is my nats-server configuration file : |
@li1786422 maybe unrelated, but in https://gist.github.com/li1786422/ef00570081dca4d414ae9095bacfba65#file-subscribecode-txt-L96, was it supposed to be |
Hi I've re-uploaded the file and now the comments section can be downloaded normally without the encoding |
Can you tell me if the downloaded code is still messed up? |
I got the samples and the data, sorry was distracted with another big and
didn't get a chance to review it in detail.
…On Fri, Oct 27, 2023, 5:45 PM li1786422 ***@***.***> wrote:
@li1786422 <https://github.com/li1786422> maybe unrelated, but in
https://gist.github.com/li1786422/ef00570081dca4d414ae9095bacfba65#file-subscribecode-txt-L96,
was it supposed to be 3?
Can you tell me if the downloaded code is still messed up?
—
Reply to this email directly, view it on GitHub
<#690 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJB46HEKG3BXPDIFMONNH3YBRITXAVCNFSM6AAAAAA6QIDGO6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTOOBTGY2DCNJYGQ>
.
You are receiving this because you were assigned.Message ID: <nats-io/nats
.***@***.***>
|
That's fine, I just wanted to make sure you could get the data correctly, just look at it when you have the time |
Observed behavior
Please ask js_SubscribeSync(&sub, js, subj, &jsOpts, NULL, NULL); Subscribe to the topic and then pass the
while(1){
natsSubscription_NextMsg(&msg, sub, 5000);
if (s ! = NATS_OK)
sleep(1)//sleep 1 seconds this is pseudocode
s = natsMsg_Ack(msg, nullptr);
The method natsMsg_Destroy(msg);
}
where the configuration information for the stream is :{
jsStreamConfig cfg;
jsStreamConfig_Init(&cfg);
cfg.Name = stream;
// Set the subject
cfg.Subjects = (const char*[1]){subj};
cfg.SubjectsLen = 1;
// Make it a memory stream.
cfg.Storage = js_MemoryStorage;
// Add the stream,
s = js_AddStream(&si, js, &cfg, NULL, NULL);
}
Publish message by{
js_Publish(nullptr,js,subject,data,len,nullptr,nullptr)
}
Continuously print the data, the order of the fetched data is messed up what is the reason why the client pulls the When the client pulls data, how to ensure the data order is correct when it stays for a while and then pulls the data again?
I am following the js_sub.c in the provided example where the differences are {
example : s = js_SubscribeSync(&sub, js, subj, &jsOpts, &so, &jerr);
my : s = js_SubscribeSync(&sub, js, subj, &jsOpts, NULL, NULL); }
}
where example's so is initialized as follows{
jsSubOptions so;
if (s == NATS_OK)
{
so.Stream = stream;
so.Consumer = durable;
if (flowctrl)
{
so.Config.FlowControl = true;
so.Config.Heartbeat = (int64_t)1E9;
}
}
}
my :{
jsSubOptions so;
if (s == NATS_OK)
{
so.Stream = stream;
so.Consumer = durable;
}
}
When I also use , it reports at runtime:NOT FOUND
Expected behavior
The fetched sequence is the same as the published sequence, and there is no duplication of receiving the received data
Server and client version
nats-server is 2.9.21
natsclient-c 3.61
Host environment
windows10 cpu :i9-12900
Steps to reproduce
No response
The text was updated successfully, but these errors were encountered: