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

io.miragon.miranum.connect.camunda7.remote.message.Camunda7MessageAdapter Maven / Gradle / Ivy

There is a newer version: 0.7.3
Show newest version
package io.miragon.miranum.connect.camunda7.remote.message;

import io.miragon.miranum.connect.message.api.CorrelateMessageCommand;
import io.miragon.miranum.connect.message.impl.DeliverMessagePort;
import io.miragon.miranum.connect.message.impl.MessageCorrelationException;
import lombok.RequiredArgsConstructor;
import org.camunda.community.rest.client.api.MessageApi;
import org.camunda.community.rest.client.dto.CorrelationMessageDto;

@RequiredArgsConstructor
public class Camunda7MessageAdapter implements DeliverMessagePort {

    private final Camunda7CorrelateMessageMapper mapper;
    private final MessageApi messageApi;

    @Override
    public void deliverMessage(final CorrelateMessageCommand command) throws MessageCorrelationException {
        try {
            final CorrelationMessageDto dto = this.mapper.map(command);
            this.messageApi.deliverMessage(dto);
        } catch (final Exception e) {
            throw new MessageCorrelationException("Message correlation failed.", e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy