use of io.datarouter.util.concurrent.UncheckedInterruptedException in project datarouter by hotpads.
the class BaseSqsPeekMultiOp method run.
@Override
protected final List<T> run() {
ReceiveMessageRequest request = makeRequest();
ReceiveMessageResult result;
try {
result = sqsClientManager.getAmazonSqs(clientId).receiveMessage(request);
} catch (AbortedException e) {
throw new UncheckedInterruptedException("", e);
}
List<Message> messages = result.getMessages();
return messages.isEmpty() ? List.of() : extractDatabeans(messages);
}
use of io.datarouter.util.concurrent.UncheckedInterruptedException in project datarouter by hotpads.
the class SqsAckOp method run.
@Override
protected Void run() {
String handle = StringCodec.UTF_8.decode(key.getHandle());
var deleteRequest = new DeleteMessageRequest(queueUrl, handle);
try {
sqsClientManager.getAmazonSqs(clientId).deleteMessage(deleteRequest);
} catch (AbortedException e) {
throw new UncheckedInterruptedException("", e);
}
return null;
}
use of io.datarouter.util.concurrent.UncheckedInterruptedException in project datarouter by hotpads.
the class SqsPutOp method run.
@Override
protected Void run() {
FieldGeneratorTool.generateAndSetValueForFieldIfNecessary(fieldInfo, databean);
String encodedDatabean = codec.toString(databean, fielder);
if (StringCodec.UTF_8.encode(encodedDatabean).length > BaseSqsNode.MAX_BYTES_PER_MESSAGE) {
throw new SqsDataTooLargeException(List.of(encodedDatabean));
}
var request = new SendMessageRequest(queueUrl, encodedDatabean);
try {
sqsClientManager.getAmazonSqs(clientId).sendMessage(request);
} catch (AbortedException e) {
throw new UncheckedInterruptedException("", e);
}
return null;
}
use of io.datarouter.util.concurrent.UncheckedInterruptedException in project datarouter by hotpads.
the class SqsGroupPutMultiOp method flush.
private void flush(List<byte[]> group) {
if (group.isEmpty()) {
return;
}
String stringGroup = codec.concatGroup(group);
SendMessageRequest request = new SendMessageRequest(queueUrl, stringGroup);
try {
sqsClientManager.getAmazonSqs(clientId).sendMessage(request);
} catch (AbortedException e) {
throw new UncheckedInterruptedException("", e);
}
}
Aggregations