package com.njzscloud.common.mqtt.support;

import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;

import java.lang.reflect.Method;
import java.util.function.Consumer;

@RequiredArgsConstructor
public class MsgConsumer implements Consumer<MqttMsg> {
    private final Object object;
    private final Method method;

    @SneakyThrows
    public void accept(MqttMsg msg) {
        method.invoke(object, msg);
    }
}
