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

org.yamcs.artemis.CmdHistoryTupleTranslator Maven / Gradle / Ivy

There is a newer version: 4.10.9
Show newest version
package org.yamcs.artemis;

import org.apache.activemq.artemis.api.core.client.ClientMessage;
import org.yamcs.api.artemis.ArtemisApiException;
import org.yamcs.api.artemis.Protocol;
import org.yamcs.cmdhistory.Util;
import org.yamcs.protobuf.Commanding.CommandHistoryEntry;
import org.yamcs.yarch.Tuple;

public class CmdHistoryTupleTranslator implements TupleTranslator {

    @Override
    public ClientMessage buildMessage(ClientMessage msg, Tuple tuple) {
        CommandHistoryEntry che = Util.transform(tuple);
        Protocol.encode(msg, che);
        return msg;
    }

    @Override
    public Tuple buildTuple(ClientMessage msg) {
        try {
            CommandHistoryEntry che = (CommandHistoryEntry) Protocol.decode(msg, CommandHistoryEntry.newBuilder());
            return Util.transform(che);
        } catch (ArtemisApiException e) {
            throw new IllegalArgumentException(e.toString(), e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy