Schedule a Webservice call using spring integration - web-services

I want to schedule (with date time) a Webservice call using Spring integration. I am planning to use the below configuration to invoke the REST Webservice. I am new to Webservice and SI. Could any of you help me to come up with a scheduler to do the same?
<int-http:outbound-gateway request-channel="sampleRequestChannel"
reply-channel="sampleReplyChannel"
url="http://<server details>"
http-method="POST" expected-response-type="java.lang.String" />

To read the data from DB there is JDBC adapters. One of them is:
<int-jdbc:inbound-channel-adapter>
<int:poller/>
</int-jdbc:inbound-channel-adapter>
with which you can poll some table in DB periodically for the fresh value of date and time and send it as a payload to the Spring Integration flow.
Another is <int-jdbc:outbound-gateway> which is based on the upstream flow and can be triggered by user event.

Related

How can I publish to subscriber based on connection id via go library `graph-gophers`

I am using graph-gophers library to build graphql application on the server side. I have a lambda works as resolvers and websocket apigateway which works as transport layer. The lambda will take the request from apigateway then call graph-gophers library schema methods to trigger resolver. It works well for query and mutation. But I am not sure how to make it work for subscription.
The library graph-gophers requires the subscription resolver to return a go channels which it listens to. but in case of lambda which is a short lived application, it can't keep alive for a long time. That means I can't use channel for publishing data.
What I am doing is to save the socket connection id on a database, when there is a need to publish data, I will grab the connection id from db to find all the subscribers. But I don't know how to trigger the publish in this case. Anyone has any idea about how to do that?

How to load test an asynchronous pipeline?

I have the following pipeline in AWS
API-Gateway -> Lambda -> Kafka(Amazon MSK) -> Consumers
I need to load test the entire pipeline and each component in the pipeline (to identify bottlenecks)
I don't have any prior experience in load testing. So, didn't know where to start. Some blogs mentioned JMeter can be used to do the load testing. But later got to know that the pipeline is asynchronous and it can't be done using JMeter.
How can I load test the pipeline? Is there any standard way to do it?
Any help is greatly appreciated. Thanks!
You can use any load testing tool which is capable of sending message to the API gateway and then reading it from Kafka.
When it comes to JMeter it's capable of both:
API Gateway: Building a WebService Test Plan
Kafka consumer: Apache Kafka - How to Load Test with JMeter
If you want to measure the cumulative duration of the request from API till it gets "consumed" - Transaction Controller

Xamarin.Android handling connection failures when calling web service

We're developing warehouse app for picking items which sends requests to a web service on every item scan, e. g. to update the quantity scanned in DB. From the log files I saw thet every now and then the connection on android scanners is lost and that leads to item quantity not being updated or in worst case an app crash.
What would be the best way to handle such connection failures so that I can ensure that the call to web method was successul before continuing code execution? Should I define some variable which accepts response from the web method and repeat the call until success is returned? Or is there some smarter way?

web service best practice - server timeout longer than http client timeout

I am trying to build a web service on top of hbase, so the code looks roughly like:
#GET
#Path("/blabla")
#Override
public List<String> getEvents($$$params$$$) {
......
//calling hbase query the events
......
}
When Hbase service is down, the hbase Java API keeps retrying to connect to Hbase region server util eventually it times out and throws a RT Exception:
NoServerForRegionException: Unable to find region for event,,99999999999999 after 10 tries.
The logic has no problem, my issue here is that the HttpClient times out way before hbase times out the retries. Then my web service API consumer gets no response, ugly.
Question -
What's the best practice here if you have server's timeout potentially longer than the http connection itself? How to have the web service respond to client gracefully in this case?
set the cashing for you scan object to some reasonable value. another thing, since you are using a web service to show the results to your users, i am assuming that you must be showing only a few rows(or records) at a time. you can use Hbase PageFilter so that you get only a specified no of rows each time and don't have to wait to get all the rows in one shot.

Timestamp of server from a web service call

Is there a way that I can retrieve the timestamp of a web service call? I'm trying to get the time of the server hosting the web service.
Easiest thing to do is to just log them in the server implementation of your service contract, you can use PostSharp to make some attributes to take of this aspect.
For instance, you can write a Trace attribute which simply logs a debug message when a method is invoke. Here's one I wrote a while back which tracks how long a method takes and log a warning message if it takes longer than a set threshold:
http://theburningmonk.com/2010/03/aop-method-execution-time-watcher-with-postsharp/
I came across some 'trace' attribute example before, if you want I can look for it for ya.