I would like to send one API request on the Google Compute Engine, instead of sending 100 requests, in order to reduce HTTP traffic.
Here is a description of how to do this when using plain HTTP calls. I am interested in achieving the same goal using Google's Java API client library
I am also aware of creating groups of instances using templates, but I didn't find a way to attach extra disks that are not read-only.
Related
Using Spring-boot-actuator API I need to count the number of API hits per clientID. How can I achieve this? Another challenge is my application is deployed on AWS and Azure. At any time I want to know the total API hit count across all environments.
There are multiple ways to do it. You have use tools like newrelic to capture that.
It uses java agent to bound to each API call.
Another option is you can use logging system to push logs and then accumulate and show using splunk, kibana. there you can create dashboard based on logs to check API hit.
You can implement your own approach, as an API interceptor/ControllerAdvice to send request hit in a separate async thread.But then you have to implement real time aggregration of these hits.
I must create a small IOT platform based on Spring Boot/Java 8.
Context: Devices send some various informations to the platform. I must save them and after consume them in an analysis algorithm.
Constraint: I want it all be async and the platform must be based on Java8/Spring technologies or must be easily integrated in a spring boot app.
What I imagine? I thought send devices' informations to Async Spring REST controller and save them async in Mongodb.
I have already the analysis algorithm based on Google Guava Event Bus.
To resume, I have datas from devices in Mongodb database and an algorithm based on Java POJO and the last part which is missing is transform datas from devices to Java POJO.
With which technologies can I do that? Spring Reactor? RxJava? Something else? And how can I put this in place?
I search something simple to put in place which can easily scale by instance duplication for example. For the moment, I thought that Spring Cloud technologies is a bit too big for my purpose.
You should have a look at Spring XD engine.
Spring XD Enables Different Sources (HTTP, FTP, MQTT, File etc), Transformers, Filters, Sinks (HTTP, FTP, MQTT, File etc).
Please check this post on a small IoT Project based on Spring XD and Twitter API.
I have to write a REST client to consume a service written in .Net. The problem is that the .Net service returns a gzip compressed serialized DataSet. How do I parse it? I have seen other solutions explaining how to do it using SOAP (I have to use REST). Another solution says to write a .Net proxy. But my deployment server is a linux machine with limited access so I may not have the luxury of using tools like Mono.
The folks exposing service haven't provided any wsdl specs. Just given ways to construct URLs that when invoked will return what I need. So what's my way forward :
Try SOAP? Is that even possible? I have no wsdl info. So I assumed it will be REST.
Create a .Net proxy that consumes this service and converts to more readable xml, and find ways to make this .Net exe run on linux?
Continue searching for a solution/library that can read DataSet? I have been developing clients using Spring RestTemplate which doesn't seem to work here.
Also, accessing the URL from Advanced Rest client shows that Content-Type: compressed/DataSet
So I had to end up creating a .Net proxy that decompresses and deserializes the DataSet response, convert to xml and save at a shared location from where Java program can pick up.
https://code.google.com/p/jsonengine/
I have uploaded it to my app engine, I can see the Admin Panel but i'm not sure how I can use it to make json requests.
Do I have to write my own classes or does it do it automatically?
Can someone explain to me how this library works. I have read the wiki many times and I don't get it.
Can I use this library to make json requests from my mobile app to list/update/create records on the server?
JSONEngine is a RESTful database. It is not a library to make JSON requests, it is a library to store/retrieve/handle JSON requests. Its not a library, its a server.
You can read/write data to it by making HTTP calls, as documented in their Usage Guide. Its up to you to decide how (or what library) that you want to save/retrieve data from this JSONEngine. There are dozens of Java libraries for accessing REST API, such as UniRest for example.
| Can I use this library to make json requests from my mobile app to list/update/create records on the server?
Nope, again this is not a library, its a server. You can use any Java REST library to make calls to store/retrieve data from this JSONEngine server.
EDIT: Additional clarification
We have a server application (implemented in Java) that will provide some data for our mobile apps. The apps will be created for Android and iOS.
Which is the best protocol / library for this purpose? The overhead of the protocol should be as small as possible.
Thanks.
Edit: It should be a request->response szenario. Data lost is not acceptable. The answer could contain a long list of data and therfore less overhead is required.
The client shall request the data (a specified key and some definied parameters) e.g. "give me all file from folder x that have the extension y". The server answers with the list.
The first idea was using XMLRPC, but the generated responses are too large.
For most applications, HTTP(S) is the best protocol to use. The overhead (i.e. headers) is pretty small, the transfer can be gzipped, the connection can be secured (via SSL). Also, ports 80 (HTTP) and 443 (HTTPS) will be open in 99% of cases. Other ports are not -- for example some carriers block all other ports unless you pay extra.
As for the implementation, I suggest a RESTful web service using the JSON format. JSON is well standardized, has small overhead and you have good libraries for working with it in any language (check out org.json, which is bundled with Android but can be downloaded as standalone for other applications as well). Check out this question, too:
https://stackoverflow.com/questions/338586/a-better-java-json-library
Use Jackson parser or Gson parser instead of JSON Parser.
1.Jackson is 2X faster than JSON and it is suitable for parsing complex and extremely big jsons.
2.Gson competitively faster than JSON.
In My Opinion, you should use REST/SOAP web sevices based on document-oriented structures, This will be helpful in the Large response.
You can also integerate Apache SOLR for this Purpose this is used for Indexing the Large Datasets and is even much faster and it is also REST enabled, you can index your data in the SOLR cores and then create REST calls from Client i.e. IOS, Android, PHP etc. so the documents will already be processed and you just need to add filters and other things as required on client.
Let me know if you want any more help regarding this.
Another protocol you can use today (2021) is gRPC. It has many advantages over classic REST APIs for mobile apps, namely faster serialization and smaller data load (because it's binary, not JSON).
Because of that it's also easier for device bateries.
Transmitting data from mobile devices to a backend server can be a very resource-intensive process. Using the standard HTTP/1.1 protocol,
frequent connections from a mobile device to a cloud service can drain
the battery, increase latency, and block other apps from connecting.
By default, gRPC runs on top of HTTP/2, which introduces
bi-directional streaming, flow control, header compression, and the
ability to multiplex requests over a single TCP/IP connection. The
result is that gRPC can reduce resource usage, resulting in lower
response times between your app and services running in the cloud,
reduced network usage, and longer battery life for client running on
mobile devices.