How to do a Health Check call in AmazonKinesis - aws-sdk

I have an intermittent error sending records to a kinesis stream
I built a kinesis client of type com.amazonaws.services.kinesis.AmazonKinesis
I'd like to make a health check call and log the results whenever sending a record fails.
I can't find a health check call in the AWS documentation.
Is there a way to do a health check call? Or a workaround with a equivalent function?

Related

Netflix DGS GraphQL Subscription Produces empty Security Context - How can this be made available?

We are using the following stack :
Kotlin 1.6.0 running on JVM 11
com.netflix.graphql.dgs:graphql-dgs-spring-boot-starter 5.0.4
com.netflix.graphql.dgs:graphql-dgs-subscriptions-websockets 5.0.4
com.netflix.graphql.dgs:graphql-dgs-subscriptions-websockets-autoconfigure 5.0.4
org.springframework.boot:spring-boot-starter-security 2.6.7
org.springframework.boot:spring-boot-starter-oauth2-resource-server 2.6.7
We are authenticating using the Google Identity Platform from the client side and passing the resulting Bearer token to the DGS API.
The pure HTTP requests (DgsQuery, DgsMutation) are able to extract the processed/validated token without an issue - and we are able to determine the userId from this.
Expected Results
When calling a subscription graph call we are expecting to extract the same details from the processed Bearer token - so we can then utilise the User Identification within the business logic.
Actual Results
The SecurityContextHolder returns an authorization value that is null. And passing in an invalid token still correctly returns subscribed results, suggesting that the subscription endpoint is not being hooked into the JWT authentication at all.
Question
What would be the recommended approach in providing the same authentication behavior and availability of Security Context to Subscriptions as is available to both DGSQuery and DGSMutation annotated functions?
From research - I understand that this needs to be performed in the initial handshake and then saved to the session.
Worth mentioning - that when calling the server from the GraphiQL UI - therefore using the newest protocol - the authentication occurs and the Security Context is populated with the correct information. However, this then fails with "Trying to execute subscription on /graphql. Use /subscriptions instead!" - which is to be expected with the incompatible client/server versions.

Azure pipeline API call gate success criteria evaluation

In my azure pipeline I have a post release gate that I want to call my API to make sure it was deployed and is returning values that I expect.
I have added the service connection and am able to get a response from the API, but I am unsure how to evaluate the response, which is just an array of values :
["ACURA","ALFA ROMEO","AUDI","BMW","BUICK"]
How to I first check that the call was successful, and secondly check the existence of "AUDI" in the return values?
I think you could add a new stage which under your current stage.
When you current stage's Deployment Gate uses Invoke REST API task to response the values, as long as the new stage runs, the API call is sure to have succeeded.
To check the value, use Postman to get the returned values of the api.

is it possible to send a data when a websocket connection is opened

I am implementing a Jetty Websocket servlet.
When the server receives a new connection, I want to send a message that will be read by websocket's onopen function. I want this message to be sent only during the open and not using the regular connection.SendMessage() function. Is it possible to do that? and how?
Don't forget the query string. It's valid in WebSocket url.
new Websocket('ws://yoursite.com/path?a=1&b=2&c=3')
Then you can easily parse this url on server side to retrieve the data.
There is no support for this in the protocol but you could fudge something yourself.
When your server completes a handshake, store the initial message you want to deliver to a client.
In your client's onopen function, send a "read initial message" request.
In your server, check that this client hasn't read its initial message; respond with the message; set a flag saying that the initial message has been sent.
Your client and server are both now free to send other messages.

Is there a way to configure a "Topic exchange" to send the non routed messages to a queue?

With the default behaviour when a message is not routed the message is lost.
You could create a queue that receives all messages by using the # for the routing key in the binding. Then create a process that handles all the non routed messages. The process will have to connect to the queue and receive all messages and somehow know whether they have been routed or not. What you will need to do is call the management plugin cli to return all the bindings for an exchange. Parse that result to get you this list of the bindings for the exchange and ignore any incoming message which matches the bindings. Then you can just process the ones that never got routed in the first place. You could even read them back to another queue for a worker process to consume.
have a look at this for information on the management plugin cli.
If you prefer to use the rabbitmqctl you could use
sudo rabbitmqclt report
to get a report that would need to be parsed to get all the bindings. See here

Handling all exceptions AND Failed Messages in a BizTalk 2010 solution

I have a BizTalk 2010 solution that polls a database table, retrieves unprocessed records, does a transform with a map and call a 3rd party service. The happy path is working.
Here is the workflow:
Receive Location/Port from GetUnprocessedCustomers stored procedure: Poll SQL Server 2008 with WCF-SQL adapter by calling stored proc that returns unprocessed customers (WHERE IsProcessed = 0)
SendPort to 3rd Party web service: Filtered to ReceivePortName == with an outbound map to convert message returned from the above mentioned stored proc to service schema
SendPort to UpdateIsProcessed stored proc: Filtered to MessageType == with an outbound map to convert service response to stored procedure call that will update IsProcessed = 1.
I would like to catch the following possible exceptions, create a message with exception info and call an internal exception handling service.
Database or stored procedure is not accessible.
3rd party service is not accessible.
I was able to handle number 2 above by enabling Failed Message routing. Thanks to Greg.Forsythe.
My question is:
How can I create a generic solution that will capture all exceptions and send exception info (such as exception datetime, message, stack trace etc.) to an internal service?
I was able to get an answer on the BizTalk General Forum. The short answer is "There is no way to catch all exceptions". Hit the link for some options.