Currently developing an app for observing changes in a JCR Repository and replicate this changes to another repository. I can't rely on a cluster JCR cause the two repositories won't be on the same network, and the connection is not reliable, so my implementation takes care of the communication problem using a REST API between the two servers, and give some fault tolerance guarantees. The problem is I need to serialize nodes, preferably in a JSON format, and parse that JSON into a Node on the other side.
I've tried Apache Sling, using some internal classes it can serialize perfectly the node into a JSON format, but I can't seem to find a way to deserialize into a Node Object on the other side. Any ideas?
The Apache Sling POST Servlet can import JSON content, see "importing content structures" at http://sling.apache.org/documentation/bundles/manipulating-content-the-slingpostservlet-servlets-post.html
Another option is the new replication module that has recently been contributed, that might be just what you need. It's at http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/replication/ , there might not be any docs yet but if you ask on the Sling users mailing list I'm sure you'll get help on how to use it.
Related
I have several json files that represent the payload for different API's(I can map which API to call based on the file name, but other methods could be applied as well),
what is the best practice to populate my data on the application with the help of those json files?
My first though was to use some automation framework(rest assured for example) to accomplish my task, but I think it might be an overkill for my scenario.
p.s. snapshot of DB/query direct to DB is not an option because of the nature of the application.
I am trying to produce JSON records from my Scala Producer code to Kafka topic. It is successfully generated, however I am not able to register the schema and do schema evolution compatibility checks.
I am not able to find any proper code/doc references. How do I register my JSON schema and consume by connecting to schema registry client and check for the compatibilities.
Any suggestions please? (more about what am trying Class io.confluent.kafka.serializers.json.KafkaJsonSchemaSerializer could not be found)
Compatibilities are checked server-side automatically upon producing, which in-turn registers the schemas, by default.
You provide schema.registry.url to the Producer and Consumer properties when using the clients and the JSONSchema(De)Serializer classes
I am new to wiremock and I am using the wiremock JSON mappings to test some of the scenarios in my project.
In one of the test scenarios, I need to give response 200 OK after 2 retries(500) to the server which is trying to access one of the JSON mappings URL (say /retry).
I am able to achieve this by referring to the stateful behavior of wiremock http://wiremock.org/docs/stateful-behaviour/
But the problem is this it works only when one server or thread is accessing it. But if multiple server/instances/thread will try to access the same this will lead to inconsistent behavior as wiremockis changing the states internally.
So the query is how I make this scenario thread-safe to have consistent result?
P.S.: I am ready to move from JSON mapping to JAVA Usage of wiremock or even JUnits usage. But not sure if that will solve my problem. Also The Junit Usage I don't want to use because I am not doing this changes in my existing project in test module rather I am creating separate wiremockserver to test independently.
i would like to ask this for my second project of web apps, we were told to design and create javascript app that gets the information from a pre-defined database, and allows to add more data to it, modify it, erase any register, and search. That's pretty easy, but the thing is that our teacher asked that in the moment the browser makes the query to the server and this access the database, the server should return the response in form of a JSON.
I do not know how this is done, thats why i'm asking for a bit of assistance, since i always saw JSONs like libraries that can be add to a Javascript app.
You should pick a technology for creating a web accessible server api.
One common one in the .Net world is WEB API. You can also look into NodeJs (maybe using Express).
Json is really just a data format. It serves the same role as xml, but using a different notation.
Some frameworks like Asp.net Web API do content negotiation and returns data in the format requested in the http header (content type). Other solutions might require you to manually serialize the return data into JSON.
Link http://www.asp.net/web-api
I have a use case where I need to validate JSON objects against a schema that can change real time..
Let me explain my requirements..
I persist JSON objects (MongoDB).
Before persisting I MUST validate the data type of some of the
fields of JSON objects (mentioned in #1) against a schema.
I persist the schema in mongodb.
I always validate the JSON objects against the latest schema available in db. (so I dont think it matters much even if the schema can change in real time for me it is kinda static).
I am using a J2EE stack (Spring Framework).
Can anyone guide me here..?
Another way of doing it is to use an external library https://github.com/fge/json-schema-validator to do the work for you. The one I proposed supports draft 4 of JSON Schema.
The IBM DataPower appliance has JSON Schema validation support. This will allow you to offload validation to an appliance that is designed for it along with routing of data within te enterprise.