QuickFix - messages out of sequence - sequence

What could cause a message to sent out of sequence like this?
20150731-12:42:46.096 : 8=FIX.4.2^A9=57^A35=0^A34=1400^A49=erio123^A52=20150731-12:42:46.094^A56=B^A10=014^A
20150731-12:43:00.916 : 8=FIX.4.2^A9=207^A35=D^A34=1401^A49=erio123^A52=20150731-12:43:00.916^A56=I
20150731-12:43:31.019 : 8=FIX.4.2^A9=57^A35=0^A34=1402^A49=erio123^A52=20150731-12:43:31.015^A56=B^A10=004^A
20150731-12:44:01.048 : 8=FIX.4.2^A9=207^A35=D^A34=1404^A49=erio123^A52=20150731-12:44:01.048^A56
20150731-12:44:01.048 : 8=FIX.4.2^A9=57^A35=0^A34=**1403**^A49=erio123^A52=20150731-12:44:01.023^A56=B^A10=002^A
20150731-12:44:01.116 : 8=FIX.4.2^A9=102^A35=4^A34=1403^A43=Y^A49=
20150731-12:44:32.067 : 8=FIX.4.2^A9=57^A35=0^A34=1405^A49=
20150731-12:45:02.079 : 8=FIX.4.2^A9=57^A35=0^A34=1406^A49=

Those two messages weren't sent out of sync, they were sent at the same millisecond. This can happen occasionally when sending lots of messages in a short time due to network latency; you have to reorder them on the receiving side.

Related

AWS: Move message to Dead letter queue while preserving meta information

I am trying to move the message to dead letter queue in AWS if there is an exception while handling the message.
Now I am deleting the original message and sending it to DLQ explicitly. However, while doing this I am losing the message meta information like Original message-id, Total receive count, first sent time stamp etc.
Below is the code snippet for the same.
#Inject
#Named("demo-queue")
private SimpleQueueService sqsService;
#Inject
#Named("dlq")
private SimpleQueueService dlqService;
.
.
.
List<Message> messages = sqsService.receiveMessages(10, 30, 20);
messages.forEach(
m -> dlqService.sendMessage(m.getBody(),
attr -> {
new SendMessageRequest()
.withMessageAttributes(m.getMessageAttributes())
.withMessageBody(m.getBody());
})
);
messages.forEach(message -> sqsService.deleteMessage(message.getReceiptHandle()));
After reaching max receive count when AWS moves the message from the original queue to DLQ it preserves all mentioned attributes. Is there any way we can achieve the same using aws-sdk?
I am using the Agorapulse library with Micronaut to send/receive messages from SQS.

How to set message priority for embedded activeMQ using spring JmsTemplate?

I am following this guide- https://spring.io/guides/gs/messaging-jms/
I have few messages with higher priority that needs to be sent before any other message.
I have already tried following -
jmsTemplate.execute(new ProducerCallBack(){
public Object doInJms(Session session,MessageProducer producer){
Message hello1 =session.createTextMessage("Hello1");
producer.send(hello1, DeliveryMode.PERSISTENT,0,0); // <- low priority
Message hello2 =session.createTextMessage("Hello2");
producer.send(hello1, DeliveryMode.PERSISTENT,9,0);// <- high priority
}
})
But the messages are sent in order as they are in the code.What I am missing here?
Thank you.
There are a number of factors that can influence the arrival order of messages when using priority. The first question would be did you enable priority support and the second would be is there a consumer online at the time you sent the message.
There are many good resources for information on using prioritized messages with ActiveMQ, here is one. Keep in mind that if there is an active consumer online when you sent those messages then the broker is just going to dispatch them as they arrive since and the consumer will of course process them in that order.

Paypal error 10413

I am working with the paypal express checkout API and am having issues.
I have a request like so:
METHOD=SetExpressCheckout
...
&L_PAYMENTREQUEST_0_NAME0=Individual%20Gross%20&%20Net
&L_PAYMENTREQUEST_0_AMT0=65.00
&L_PAYMENTREQUEST_0_QTY0=1
&PAYMENTREQUEST_0_AMT=70.26
&PAYMENTREQUEST_0_TAXAMT=5.26
&PAYMENTREQUEST_0_ITEMAMT=65.00
&PAYMENTREQUEST_0_PAYMENTACTION=Sale
&PAYMENTREQUEST_0_CURRENCYCODE=USD
I have reviewed this many times and see no error in the math, yet this is what paypal sends me.
TIMESTAMP : 2017-03-22T01:41:05Z
CORRELATION ID : e22e8009c7018
ACK : Failure
VERSION : 88.0
BUILD : 31129382
L_SEVERITYCODE0 : Error
Error Code : 10413
Transaction refused because of an invalid argument. See additional error messages for details.
The totals of the cart item amounts do not match order amounts.
I found that PayPal responded this way because I did not include L_PAYMENTREQUEST_0_NUMBER0 . After including that field, it was accepted. I must say that the error message sent to me lead to me to the wrong issue

How to make rabbitmq to refuses messages when a queue is full?

I have a http server which receives some messages and must reply 200 when a message is successfully stored in a queue and 500 is the message is not added to the queue.
I would like rabbitmq to refuse my messages when the queue reach a size limit.
How can I do it?
actually you can't configure RabbitMq is such a way. but you may programatically check queue size like:
`DeclareOk queueOkStatus = channel.queueDeclare(queueOutputName, true, false, false, null);
if(queueOkStatus.getMessageCount()==0){//your logic here}`
but be careful, because this method returns number of non-acked messages in queue.
If you want to be aware of this , you can check Q count before inserting. It sends request on the same channel. Asserting Q returns messageCount which is Number of 'Ready' Messages. Note : This does not include the messages in unAcknowledged state.
If you do not wish to be aware of the Q length, then as specified in 1st comment of the question:
x-max-length :
How many (ready) messages a queue can contain before it starts to drop them from its head.
(Sets the "x-max-length" argument.)

NServiceBus setting time to be received

Can you set TTBR (Time To Be Received) on a message sent using NServiceBus?
Absolutely - put the TimeToBeReceived attribute on the relevant message class. Here's an example setting it to 10 minutes:
[TimeToBeReceived("00:10:00")]