io.github.springwolf.plugins.sqs.producer.SpringwolfSqsProducer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of springwolf-sqs Show documentation
Show all versions of springwolf-sqs Show documentation
Automated JSON API documentation for AWS SQS Listeners built with Spring
// SPDX-License-Identifier: Apache-2.0
package io.github.springwolf.plugins.sqs.producer;
import io.awspring.cloud.sqs.operations.SqsTemplate;
import lombok.extern.slf4j.Slf4j;
import java.util.List;
import java.util.Optional;
@Slf4j
public class SpringwolfSqsProducer {
private final Optional template;
public SpringwolfSqsProducer(List templates) {
this.template = templates.isEmpty() ? Optional.empty() : Optional.of(templates.get(0));
}
public boolean isEnabled() {
return template.isPresent();
}
public void send(String channelName, Object payload) {
if (template.isPresent()) {
template.get().send(channelName, payload);
} else {
log.warn("SQS producer is not configured");
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy