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

io.nosqlbench.driver.jms.util.JmsHeaderLongFunc Maven / Gradle / Ivy

Go to download

A JMS driver for nosqlbench. This provides the ability to inject synthetic data into a pulsar system via JMS 2.0 compatibile APIs. NOTE: this is JMS compatible driver from DataStax that allows using a Pulsar cluster as the potential JMS Destination

There is a newer version: 4.15.97
Show newest version
package io.nosqlbench.driver.jms.util;

import lombok.*;

import javax.jms.DeliveryMode;
import javax.jms.Message;
import java.util.function.LongFunction;

@Setter
@Getter
@NoArgsConstructor
public class JmsHeaderLongFunc implements LongFunction {
    private LongFunction deliveryModeFunc;
    private LongFunction msgPriorityFunc;
    private LongFunction msgTtlFunc;
    private LongFunction msgDeliveryDelayFunc;
    private LongFunction disableMsgTimestampFunc;
    private LongFunction disableMsgIdFunc;

    @Override
    public Object apply(long value) {
        return new JmsHeader(
            (deliveryModeFunc != null) ? deliveryModeFunc.apply(value) : DeliveryMode.PERSISTENT,
            (msgPriorityFunc != null) ? msgPriorityFunc.apply(value) : Message.DEFAULT_PRIORITY,
            (msgTtlFunc != null) ? msgTtlFunc.apply(value) : Message.DEFAULT_TIME_TO_LIVE,
            (msgTtlFunc != null) ? msgTtlFunc.apply(value) : Message.DEFAULT_DELIVERY_DELAY,
            (disableMsgTimestampFunc != null) ? disableMsgTimestampFunc.apply(value) : false,
            (disableMsgIdFunc != null) ? disableMsgIdFunc.apply(value) : false
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy