DWR polling interval - polling

Does anyone know how to change the DWR polling interval? This is really hard to find on the net for some reason.

Because there isnt a polling interval. you have to poll manually from a script

Related

Node send text after X amount of time?

Let's say you have a parking meter app. User selects an amount of time and pays. 20 minutes before their time is up you want to send them a text via Twilio that their time is almost up. I'm not concerned about the payment or text part. What's the best way to do the timing aspect in Node that triggers the function that sends the text 20min before their time is up? Im aware of setTimeout, but is this a scalable method of handling this? IIRC, setTimeout doesn't execute at exactly the end of it's timer, but is dependant on when it can execute within the event loop. Let's assume you may need a couple hundred timers running at once and your server is realtively busy with other users triggering other callbacks and async functions. Also, the text doesn't necessarily have to be sent at exactly 20min before their time is up, a couple minutes margin of error would be acceptable. Thanks for any help!

A few specific ServiceBus questions AutoRenewTimeout, Filtering, DeleteSubscription, PeekAndLockMode

I have a few specific questions related to service bus, that I wanted to get more insights into. I have read a lot of blogs, and a lot of documentation in regards to Service Bus (SB), and have implemented a solution that works using it. The questions that I am going to ask, how not been answered, or have been answered in an unclear way, so that's why I want to get more into specifics. So here they go:
1) Just wanted to get more detail in regards to "OnMessage" function for a ServiceBus queue. From what I understand it's not a typical while()/Receive() loop with a Sleep() interval, but in fact more of a "push" based approach, according to the documentation and my testing. So my question is if I set "AutoRenewTimeout" to 1 minute, then what happens to the thread that is waiting for a message to be received for that 1 minute before issuing a new Receive() operation..Does it sleep & wait for a message from ServiceBus to get "pushed" to it? or is it more of an asynchronous approach here where a thread is released back to the pool and only grabbed again to do work when a message arrives say 47 seconds into the 1 minute AutoRenewTimeout window that I set? (No, I am not talking about "OnMessageAsync" here) I guess this question touches the internals of WCF on which SB is implemented.
2) In regards to question 1), what would the significance be of setting "AutoRenewTimeout" to 5 minutes, or 10 minutes, or 60 minutes, besides the obvious cost of Receive() operation that would be triggered at those intervals? I guess from a customer's perspective, the less frequently I trigger receive operations the more cost effective it is for me, but as far as "waiting for the message" during this period from a service bus perspective / application perspective, what is the recommened "AutoRenewTimeout" perioud? Is SB more prone to drop a connection if "AutoRenewTimeout" is set to 1 hour vs. 1 minute? are more resources / thread usages being used up when the "AutoRenewTimeout" is longer? I wasn't able to find any clear answers to this on any post/blog/documentation that I've read.
3) I have a Topic/Subscription application deployed on each server that both sends/receive messages to/from a topic. Now, I don't want each client(server) to receive the messages that it itself sent out, I only want to receive the messages that other servers(clients) sent out. I was able to implement a solution using a SqlFilter(), but I was wondering if there's any other/better way of doing this? While talking about SqlFilters(), what is the performance impact, if any, on the speed of message delivery between subscription clients when using a simple comparison SqlFilter()? (I guess I could benchmark and see for myself, but I am just curious to take a peek at the internals)
4) In regards to PeekAndLock mode on message receiver, if in a hypothetical scenario, where a message is being marked completed at the time it is received on SB end, someone was able to physically cut the wire between SB end and the application VM, then that message would be lost forever, because the application would not receive it, yet the SB would have checked it off as being Completed. Is my understanding correct, that in PeekAndLock mode the message is being marked off as completed without the application end having an sure guarantee of ever receiving it?
5) In regards to deleting a subscription for a topic, that lets say has 100 messages in it that were never received, would that count as 1 operation, or as 101 operations?
Thank you for your time and effort in taking to read this. I would be glad to clarify any point if necessary. Abhishek, you seem to be one of the architects of SB, so if you see this post, I would really appreciate if you would drop a few comments:)
Thank you!

kafka consumer polling increase the method execution time

in our application,consumer started polling continuously at the load of the application and therefore sometimes it impact the execution time for one of the
method by polling in between the method execution.
Method (let say test())which ideally take few millisecond to run in junit case is now taking few seconds for the execution in app.Therfore, would like to skip the polling
at this point of time,if possible.
In spring integration doc have seen something called PollSkipAdvice/PollSkipStrategy which says The PollSkipAdvice can be used to suppress (skip) a poll.
Could you please suggest,if this can be of any help in above scenario.Would be great, if explain using example.Thanks.
sample config:
<int-kafka:inbound-channel-adapter
id="kafkaInboundChannelAdapter" kafka-consumer-context-ref="consumerContext"
auto-startup="false" channel="inputFromKafka">
<int:poller fixed-delay="10" time-unit="MILLISECONDS"
max-messages-per-poll="5" />
</int-kafka:inbound-channel-adapter>
You scenario isn't clear. Really...
We have here only one adapter with aggressive fixed-delay every 10 MILLISECONDS and only for the small amount of messages.
Consider to increase the poll time and make max-messages-per-poll as -1 to poll all of them for the one poll task.
From other side it isn't clear how that your test() method is involved...
Also consider to switch to <int-kafka:message-driven-channel-adapter> for better control over messages.
Regarding PollSkipAdvice... Really not sure which aim would you like to reach with it...
And one more point. Bear in mind all <poller>s use the same ThreadPoolTaskScheduler with the 10 as pool. So, maybe some other long-living task keeps threads from it busy...
This your <int-kafka:inbound-channel-adapter> takes only one, but each 10 millis, of course.

Best scheduling practice using VC++ for capture in directshow

I have one capture application, that performs the MP4 capture. i need to schedule this capture application to capture video of every 30 minutes (or some dynamic value).
I read the MSDN article for IReferenceClock::AdviseTime from article i am not sure but i assume will trigger event when end-time elapses. but it not seems to work . please advice me if my understanding is incorrect about it. Or is any other batter way to repeat schedule in 30 minutes to capture video??
Thanks
IReferenceClock::AdviseTime is what let's close schedule setting an event. Filters might take advantage of this internally as a part of streaming operation. For you, however, this methods is of no use. There is a number of ways to trigger an action every 30 minutes. On a running application you would typically use SetTimer + WM_TIMER API. If you want your app started every 30 minutes, Task Scheduler is here for you.

Display a Chrome desktop notification every day at specific time

I'd like to write an extension that displays a desktop notification every day at a specified time. Having a quick look through the Chrome APIs, it seems like the only way to do this would be to:
create a background page for my extension,
use setInterval() with a sufficiently low resolution to not tax the CPU (even 5 min is fine),
when interval fires, check if the current time is after the desired time,
ensure that the user has not already been displayed the notification today.
(The details of the last step are irrelevant to my question, just put in to show I realize I need to prevent "flapping" of the notice).
This seems rather indirect and potentially expensive though; is there any way around this? Is the background page needed?
I suppose I could just call setTimeout() and only fire the event once (by calculating how long between now & desired time), then call it again after the notification is shown. For some reason that sounds more "brittle", though I'm not sure why...
I think you will want the background page to do this smoothly. You can't use a content script because you need to keep the "state"/timer.
So when background page first loads (browser start) you work out the current time and the offset to the next notification time and setInterval to that exact interval. That way you won't need to poll every five minutes and/or work out if you've shown the message. You simply show it at the exact time required. This has to be far more efficient, effective and cleaner than polling. At notification you just reset the interval again.
Some sample functions here:
setTimeout but for a given time
From reading the above post and from a quick search on the net it appears that you should have no problem calling setInterval for an interval such as once a day. Calvin suggests 25 days!
That is how I would approach it.
EDIT: Since posting one thing that has sprung to mind is what happens if a PC gets hibernated for n hours? I need to test this myself for a similar project so I will update once I've had a chance to test this out.

Resources