message send to the servicebus can be processed by consumer after some time, simply by setting ScheduledEnqueueTime param. Its easy to achieve this while working on "raw" service bus message ie:
var serviceBusMessage = new ServiceBusMessage(json);
serviceBusMessage.setScheduledEnqueueTime(someTime);
but I have azure functions java app, that has:
@FunctionName("Process-Notifications")
public void processNotifications(
@ServiceBusQueueTrigger(name = "MessageCmd", queueName = "queue_name_notify_cmd_v1", connection = "SBusConn") String messageCmd,
@ServiceBusQueueOutput(name = "NotifyForRetry", queueName = "queue_name_notify_cmd__v1", connection = "SBusConn") OutputBinding<String> notifyForRetry,
sending notification is easy here, I only do:
Map<String, Object> result = mapper.convertValue(json, new TypeReference<>() { });
String channels = "";
if (error instanceof SmsOnlyError) {
channels+="sms";
}
if (error instanceof EmailOnlyError) {
channels+="email";
}
if (error instanceof AllDefinedChannelsError) {
channels+="sms, email";
}
properties.put("retry_channels", channels);
result.put("UserProperties", properties);
result.put("ScheduledEnqueueTime", OffsetDateTime.now(defaultClock).plusMinutes(15).toString());
JsonNode newJson = mapper.convertValue(result, JsonNode.class);
hard to find something in docs, maybe someone here can me ?
thanks!
and works fine. But I have no idea how to set ScheduledEnqueueTime there..