Data synchronization 1C integration with Camunda - javascript

Colleagues, please tell me how to integrate 1C with camunda. So that this integration allows you to synchronize the data of the Catalogs with the database (mongoDB) using camunda
The ideas are to take the time of the last synchronization and filter to get from the catalog all the data that has less than this time, BUT in 1C catalogs there is no such system field that would store the date and time of the last changes

Related

Timezones management - server/client - struggling to understand

I've been reading a whole day today. I want to understand how to manage time in my webapp. So just a few bits of information to begin with: I have Laravel 9 backend and Vue3 frontend - a monolith app.
On the front end, users can create an entry in the database which contains the start and end date.
Now the problematic thing - so I want to make it so that when a user in one country creates the entry, that user will see their local time but if the user in another timezone sees that entry on the website they will see that shifted accordingly to their timezone.
Now if on the front end I am using new Date () in JS to obtain the date like this Tue Dec 27 2022 19:40:08 GMT+0000 (Greenwich Mean Time) and then send it over to laravel I get something like that in database 2022-12-27 19:40:08.
Here is what I know:
UTC is not a timezone but a time system
new Date() called in my JS app in the browser is giving me the local, time-zoned time
Laravel by default uses UTC
Both dates on the frontend and database in Laravel are the same. How that is if once of them is local time and the other one is UTC?
Can anyone explain exactly how does that work from database/js/laravel point of view? Or at least point me to some good resources?
The way I see that is I need to:
create UTC date in JS on the frontend
send it to the LAravel app which will save it in UTC in my db
display it for the user after formatting it on the frontend with Javascript to use local timezone.
It all seems very confusing to me and so far I just managed to get mostly mean comments for not understanding this.
I am mostly interested in understanding what is the correct flow here and how when I send a date from Javascript to the backend, Laravel knows how to deal with it.
Can anyone explain that?

Optimize my algorithm for Detecting SQL Records that need to be updated

I have a node app that is retrieving records from an API and upserting them to a MySQL DB.
The app will unconditionally pull all records from the last 6 months from the API (this will be run on a nightly basis). Let's say ~20k records will be downloaded every day.
Most of these 20k will probably be unaltered. Only a small amount may actually have changes in their rows.
Regardless, performing an INSERT INTO ...ON DUPLICATE KEY.. will UPSERT all 20k rows in the DB (not just the altered records). I can confirm this by printing out the result.affectedRows in the callback and verifying it matches the count from the API. This isn't particularly a problem as it only takes a few seconds to upsert all rows.
However, after this, I want to retrieve all rows that had a deleted field get changed from false to true. So..let's say only 1 in 50 of the upserted rows actually had this get changed. I need to then somehow detect these 100 rows and then will delete them from another application (using this other app's REST-based API). So in a nutshell...this node app is a broker to synchronize records between 2 different apps.
Was thinking I could loop through all 20k..find their respective records in DB..and only upsert if there was a change? This is obviously inefficient and won't scale bc of the number of DB hits.
What kind of pattern can I use here to detect this? I'd rather not loop through every record.

MongoDB Performance for Calculations

Currently developing some engineering software using PHP and MongoDB for storing the data.
I plan on doing some calculations where I am performing many calculations on a collection. Essentially, it contains data, and I want to perform calculations on the data, update the field, calculate on the next field and so on.
However, my developer has hit a snag.
He was doing what I thought would be a simple operation.
> Upload a CSV into a collection.
> Create secondary collection by transforming all of the values
> of the first collection according to user input of a value into a formula.
Similar to Excel's "Copy Value" then Paste Special Multiply.
Essentially create a new collection as product of the first
collection.
The developer reported back that this slowed his PC down to a crawl.
This concerns me that my advanced application has no hope of getting off the ground if mongo is slow to carry out this simple (to me) task.
Is there a proper way to go about performing thousands of calculations on a nosql collection? Are databases not meant for this sort of work load? Would I then have to pull the data out into an array, perform the calculations then insert the new values after the simulation is done?
I have read that java has better performance than PHP, should I direct the code toward java for engineering applications?
There are few questions needs to be checked before coming to any conclusion
1) What is the OS? for windows check the task manager for the mongod process details while you are running the queries; for linux use the top command to check the process details
2) What is the volume of data; I mean size in terms of megabyte/byte
3) If you have 2 GB RAM then you should consider splitting the data volume to less than 1 GB and start processing
4) If data volume is perfect for the RAM size then there must be disk speed/ RPM
5) If the data processing is only for localhost then you can process the data with some other laptop with higher configuration to see the outcome
6) What is the version of MongoDB you are using? try to upgrade to the latest
7) You can consider free MongoDB cluster Atlas(https://cloud.mongodb.com/user#/atlas/login) if the volume of data is not very huge
8) Can create a cluster in AWS free tier for few hours to know the outcome also
I hope you are shy away from trying. Last but not the least is your requirement.

implement an updates from mongoDB

Im developing a client-server real-time program and I need my server to be up-to-date always. Unill now I have been implement a GET request from the server every X seconds that returns all the entities from the MongoDB.
Now I have big amount of entities and I need to GET only the entities which have been updated since the last GET request.
I think about running sequence in the db for each entity and check every X seconds if the sequens have been increased.
But I will prefer a better way.
Is there any way to get only the recent changes from mongo? Or any nicer architecture ?
You can have a last updated time in the collection. In the client side, you can maintain a last get time.
In the subsequent requests, get all the documents from collection where last updated time is greater than last get time. This way you will get the documents that got updated or inserted since you last get the data (I.e. delta).
Edit:
MongoDB maintains the date object in UTC format. As long as the date at client side is maintained in UTC and send the same data in the subsequent request, it should retrieve the latest updated records.

Real Time charts: what are the techniques ,dos and donts

am working on a school project. Final year BscIT. I used spring framework, jstl, spring-data-mongo and mongodb for storage. The project has an Restful API to which pharmacies and hospitals send some data to.namely their diagnostics and the number and type of medicines purchased.
Here I am trying to show the trends in a dashboard as and when anytime occurs in the database.I use jquery as javascript framework and after studying kendo dataviz, amchart and highchart , I will be going with amchart
Now It really doesn't matter with visualization tools I use. I am more interested in how to do it and prevent the browser from freezing.
Below is what am thinking:
option 1: I will be querying the database every 5 seconds.Does that means the javascript should know the "previous" 5 seconds ? As in I will pass the previous 5 seconds as start date and now as end data?
option 2 I will pull all data of the day every 5 seconds.
Am really not sure about how it is done in real life so, anyone feel free to show me the path.
Thanks in advance

Categories