How to get ignite CacheEvent for ClientCache - ignite

I want to get the CacheEvent for update on the ignite ClientCach is made.
I have 2 Server connected and replicating data between of them.
First application is connecting using the IgniteClient(TcpClient)
'Ignition.startClient()' and publishing the update to ignite instance.
I would like the second Instance to connect to remote Server and get an update when the cache is being updated.
currently this is working only for updates from Ignite with this :
Ignition.start()

Continuous queries could help you https://apacheignite.readme.io/docs/continuous-queries You need run query from second client instance and subscribe for interested events.
To get cache events, you might try remote event listener https://apacheignite.readme.io/docs/events#section-remote-events

Related

Distributed JobRunr using single data source

I want to create a scheduler using JobRunr that will run in two different server. This Scheduler will select data from SQL database and will call an api endpoint. How can I make sure these 2 schedulers running in 2 different server will not pick same data from database ?
Main concern is they should not call the API with duplicate data from 2 different server.
As per documentation JobRunr will push the job in the queue first, but I am wondering how one scheduler queue will know that the same data has not picked by other scheduler in different server, is they any extra locking mechanism I need to maintain ?
JobRunr will run any job only once - the locking is already done in JobRunr itself.

How to make sure initial replication is completed for a new node (Apache Ignite)?

Here is a use case:
I have version 1 of a web app deployed.
It uses couple Ignite-powered distributed (configured for replication) Maps, Sets and other data structures.
I'm going to deploy v2 of this application and once data is replicated I'm going to shutdown v1 of this app and re-route users (using nginx) to new instance (v2).
I can see that Ignite on v1 and v2 can discover each other and automatically perform replication of data structures.
My intention: I don't want to shutdown 1st instance (v1) before all data is replicated to 2nd instance (v2).
Question is: how do I know if initial replication is completed? Is there any event that is fired in such cases, or maybe some other way to accomplish this task?
If you configure you caches to use synchronous rebalancing [1], second node will not complete start process before rebalancing is completed. This way you will guarantee that all the data is replicated to the second node (of course, assuming that you're using fully replicated caches).
[1] https://apacheignite.readme.io/docs/rebalancing#section-rebalance-modes

Initial query resent the data when client got reconnect

I tried to use contentious query to monitor a cache and set initial query, LocalListener and RemoteFilter as example did.
The issue I met is when client reconnect to Ignite cluster, the initial query will query the data from cache which the client might already got before.
I tried to use unchanged ID or instance name
cfg.setConsistentId("de01");
cfg.setIgniteInstanceName("test1");
but does not work.
Is any way to solve this issue?
Many thanks,
On disconnect phase of reconnect server closes query listener and loses information which updates were already sent to client. The only way not to miss some updates in that situation - run initial query again.

How To: Get Merge replication status via C#

The project I am working on uses Merger replication which works fine. Behind the scenes I have used a of service to deletes the clients side DB and get new records till a perticular mark and to check for the server connectivity.
The challenge I am currently facing is, when the service goes to starts mode after being stop, it automatically executes what its suppose to do. There is no way I can pause my service as I am not able to get the status of merge replication.
The option of steps I have/can take from the client side is
Stop the exection of my function if the MergeReplication stauts is running.
Force the Sync on Merge Replication from my C# code.
But, I do no know how to take the status of Merger Replication.
I did go through few links on StackOverFlow but nothing got me +ve results. I am stuck with this issue.
How do I check SQL replication status via T-SQL?
How to check if Merge Replication is really complete or not
How to get replication status from code
Another question is - What will happen after the 5GB mark of data is met in Sql Express when the new data is pushed to the Sql Express from the server. Fill it follow the FIFO method and delete the data which came in first automatically and starts fillup itself with the new data from the server that gets pushed?
Hope to get some +ve answers.
[EDIT: Title Corrected]
Please see How to: Synchronize a Push Subscription (RMO Programming) and How to: Synchronize a Pull Subscription (RMO Programming) for instructions on how to synchronize a Merge subscription programmatically using Replication Management Objects in C#.
This will give you the ability to synchronize subscription(s) on-demand and handle the Status event to inspect the Merge Agent progress.

Can I set a JDBC timeout for a single query?

I have a web app on Tomcat, which handles DB connection pooling, and using Spring JDBCTemplate for executing queries. It's been requested that I implement a status page which will be monitored by a heartbeat process to determine if everything is healthy with the server.
As part of this, I want to do a DB query to determine if the connection to the database is ok. Ideally, since it'd just be a 'select 1 from ', I'd want it to come back fast, within 10 seconds, to indicate a failure if the DB didn't respond in that time.
However, I don't want to change my connection to time out that quickly for normal requests.
Is there a way to set a per-query timeout using either raw JDBC or Spring JDBC wrappers?
Use setQueryTimeout on the Statement (or PreparedStatement) object.
If you are using spring to manage transactions a time out can be specified at the transaction level as well. #Transactional(timeout=10)