All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.springwolf.plugins.sqs.producer.SpringwolfSqsProducer Maven / Gradle / Ivy

There is a newer version: 1.8.0
Show newest version
// 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