I am using mongodb-queue to send the messages. To handle the errors, I'm using the separate channel which send the exceptions. When sending the exceptions, I need to retrieve the POJO.
Please let me know if you have any idea on how to do so.
You generally shouldn't be messing with the error-channel header with a header enricher - that is rarely needed; set an error-channel on the inbound endpoint. The message in the error channel will be an ErrorMessage with failedMessage and cause properties. The failedMessage is the message at the point of failure.
Related
I have setup the HttpClient with ServiceUnavailableRetryStrategy. I am making a POST call to the server with JSON payload in InputStreamEntity.
When server returns with "503 Service Unavailable" the retry strategy kicks in and makes another request after a delay read from Retry-After header.
I have enabled the logs and what I observe is, in the first request the JSON payload is sent properly. But on the retry request no payload is sent to the server and I am receiving a "400 Bad Request".
I wonder why the payload is not sent on the retry request. In my implementation of ServiceUnavailableRetryStrategy I am not messing anything with HttpResponse or HttpContext. Is it because that once the content is read from InputStreamEntity, the Entity looses the data?
Is there anyway to prevent this from happening? Any help or suggestions will be appreciated.
thanks
The issue was actually with InputStreamEntity, which is a non-repeatable Entity. This means its content cannot be read more than once. So on retry the original Entity content was lost.
When I use a repeatable Enity like ByteArrayEntity, the issue was solved.
https://hc.apache.org/httpcomponents-client-4.5.x/current/tutorial/html/fundamentals.html#d5e119
Remote wcf service needs a custom header 'MessageHeader' in the envelope. I'm adding this header, but processing response returns this error:
'The header 'MessageHeader' from the namespace
'http://www.ebxml.org/namespaces/messageHeader' was not understood by
the recipient of this message, causing the message to not be
processed. This error typically indicates that the sender of this
message has enabled a communication protocol that the receiver cannot
process. Please ensure that the configuration of the client's binding
is consistent with the service's binding.'
In classic .net recommend change BasicHttpBinding on WsHttpBinding, but core doesn't support it. Can anybody give me some advices?
It appears to be a namespace issue. Please post your RQ + RS and identify what API you are using.
I am trying to log the request bodies for REST services(POST request body) that fail when there is some kind of internal server error. I don't want to log all the request bodies as that will take a lot of memory on my disc.
The exception is happening somewhere in the dao layer (like a Key constraint or some kind of unhandled exception), where I don't have the access to the entire request.
I tried using some aop advices(after-throws) but I was not able to log the required information.
Can someone suggest an approach that needs to be followed to log the request body.
I use RESTful(javax.ws.rs) webservices.
Since no response was given, I ended up using a filter http://static.springsource.org/spring-framework/docs/3.2.0.M2/api/org/springframework/web/filter/AbstractRequestLoggingFilter.html
I need to know how we can restrict sending a "Resend Request". I'm copying the logs below. It appears that the "Resend Request" is being send from QuickFixEngine dll since we have not written any code for initiating a resend request. Please help me to solve how restrict a resend request. Also it appears that the MsgSeqNum is in correct order. Your help will be appreciated greatly.
8=FIX.4.29=5735=034=9949=UATENV52=20120717-16:31:28.29656=TRDUAT10=243
8=FIX.4.29=5835=049=TRDUAT56=UATENV52=20120717-16:28:34.24834=11910=029
8=FIX.4.29=37635=849=TRDUAT56=UATENV52=20120717-16:28:41.00434=12050=CBOEO57=Test_Trader37=1120716000006003150=139=120=060=20120717-16:28:40.00040=254=138=10442=2654=1167=OPT55=IBM44=-0.5077=O202=180.00201=1200=201207205=2121=359=01=TestAcct10115=USD14=56=0.50198=12280400019882=N17=071710150000128151=576=INCA30=CBOE75=2012071732=531=0.5011=82184825010=144
8=FIX.4.29=37935=849=TRDUAT56=UATENV52=20120717-16:28:41.00534=12150=CBOEO57=Test_Trader37=1120716000006004150=139=120=060=20120717-16:28:40.00040=254=238=20442=2654=2167=OPT55=IBM44=-0.5077=O202=185.00201=1200=201207205=2121=359=01=TestAcct10115=USD14=106=0.50198=12280400019882=N17=071720150000129151=1076=INCA30=CBOE75=2012071732=1031=0.5011=82184825010=036
8=FIX.4.29=6935=234=10049=UATENV52=20120717-16:31:35.50056=TRDUAT 7=120 *16=0* 10=230
8=FIX.4.29=37635=849=TRDUAT56=UATENV52=20120717-16:28:41.00534=12250=CBOEO57=Test_Trader37=1120716000006005150=139=120=060=20120717-16:28:40.00040=254=138=10442=2654=3167=OPT55=IBM44=-0.5077=O202=190.00201=1200=201207205=2121=359=01=TestAcct10115=USD14=56=0.50198=12280400019882=N17=071710150000130151=576=INCA30=CBOE75=2012071732=531=0.5011=82184825010=145
8=FIX.4.29=37935=834=12149=TRDUAT50=CBOEO52=20120717-16:28:41.00556=UATENV57=Test_Trader1=TestAcct1016=0.5011=82184825014=1015=USD17=07172015000012920=021=330=CBOE31=0.5032=1037=112071600000600438=2039=140=244=-0.5054=255=IBM59=060=20120717-16:28:40.00075=2012071776=INCA77=O150=1151=10167=OPT198=1228040001200=201207201=1202=185.00205=21442=2654=29882=N10=036
8=FIX.4.29=37635=834=12249=TRDUAT50=CBOEO52=20120717-16:28:41.00556=UATENV57=Test_Trader1=TestAcct1016=0.5011=82184825014=515=USD17=07171015000013020=021=330=CBOE31=0.5032=537=112071600000600538=1039=140=244=-0.5054=155=IBM59=060=20120717-16:28:40.00075=2012071776=INCA77=O150=1151=5167=OPT198=1228040001200=201207201=1202=190.00205=21442=2654=39882=N10=145
8=FIX.4.29=40735=849=TRDUAT56=UATENV52=20120717-16:28:41.444122=20120717-16:28:41.00443=Y34=12050=CBOEO57=Test_Trader37=1120716000006003150=139=120=060=20120717-16:28:40.00040=254=138=10442=2654=1167=OPT55=IBM44=-0.5077=O202=180.00201=1200=201207205=2121=359=01=TestAcct10115=USD14=56=0.50198=12280400019882=N17=071710150000128151=576=INCA30=CBOE75=2012071732=531=0.5011=82184825010=145
8=FIX.4.29=41035=849=TRDUAT56=UATENV52=20120717-16:28:41.444122=20120717-16:28:41.00543=Y34=12150=CBOEO57=Test_Trader37=1120716000006004150=139=120=060=20120717-16:28:40.00040=254=238=20442=2654=2167=OPT55=IBM44=-0.5077=O202=185.00201=1200=201207205=2121=359=01=TestAcct10115=USD14=106=0.50198=12280400019882=N17=071720150000129151=1076=INCA30=CBOE75=2012071732=1031=0.5011=82184825010=028
8=FIX.4.29=40735=849=TRDUAT56=UATENV52=20120717-16:28:41.444122=20120717-16:28:41.005
Thanks
Usually, you will get a resend request when reconnecting after a disconnect. It is important to make sure that you haven't missed any messages.
If you want to avoid it, you need to edit the quickfix config and set ResetOnLogon Logoff and disconnect to Y. That way it will not try to resend messages each time it disconnects.
I don't think this is a particularly good idea. You could miss messages. Why is the resend request a problem for you?
If you want to ignore ResendRequests (i.e you don't want to resend any messages) the correct way in FIX to do this is by responding with a SequenceReset.
You can achieve this in QuickFix be overriding the toApp() method and throwing a DoNotSend exception.
QuickFix will generate the correct SequenceReset response based on the ResendRequest that was issued.
Here's an example:
8=FIX.4.29=9135=234=349=MY-INITIATOR-SERVICE52=20160418-09:11:20.69456=MY-ACCEPTOR-SERVICE7=216=510=133
8=FIX.4.29=12435=434=243=Y49=MY-ACCEPTOR-SERVICE52=20160418-09:11:20.69756=MY-INITIATOR-SERVICE122=20160418-09:11:20.69736=2123=Y10=068
I've been looking at examples of REST API's like Netflix http://developer.netflix.com/docs/REST_API_Reference#0_59705 and Twitter and they seem to place error messages in the statusText header response instead of the responseText. We're developing an internal RESTful api and I am arguing for sending custom statusText messages and ignoring the responseText.
For the scope of our app, we're returning error 400 when the user has tried doing something they aren't supposed to, and the only error messages that will be updated in the UI for the user will be delivered with 400. I am of the belief that the message should be sent as a modified statusText but one of the engineers (who knows a bit less about REST than me) is arguing for sending it in the responseText.
What's the best way to go?
HTTP defines that you should put a descriptive error message in the response entity body, aka responseText.
statusText is not rendered or processed by any client.
I'd use the status text for the error message type, aka 400 Client Error, and the body for a description of the problem that can be rendered to the user, in whatever the format the client may be able to process.
Edit: Note that since then, a new standardised format exists to communicate in a standard fashion error details back to the client, which you can find at https://www.rfc-editor.org/rfc/rfc7807 and which I would recommend.
I think you're right, the general approach is use the existing error mechanism built into HTTP.
In general, try to map your errors to existing HTTP errors, for example if they request something they don't have permission to, return a 403 error.
If they request something that doesn't exist, return a 404.
Alex
According to the HTTP specification (rfc2616): "HTTP status codes are extensible"
However I don't think that creating new statuses for every different error message is the correct approach:
I would say choose HTTP Status appropriately (HTTP Status Code Definitions) if you can't find any category which matches your requirement create a custom one (but I'm sure you will) and put error messages in the HTTP response body.
Picking appropriate status code for your responses is extremely important as it is a key enabler of self-descriptive messages.
The entity body should be a representation of the resource's state and ideally contain hyperlinks to available next states in your application
Http Status Codes are pretty self explanatory and should be used as such. Returning 200 OK with validation errors is pretty Soap-y and misleading. Any REST Client implementation 4xx and 5xx errors go into a error block and it really depends on case to case basis if you really want to use the response body for non 2xx responses.