org.tbk.bitcoin.zeromq.bitcoinj.BitcoinjTransactionPublisherFactory Maven / Gradle / Ivy
package org.tbk.bitcoin.zeromq.bitcoinj;
import lombok.extern.slf4j.Slf4j;
import org.bitcoinj.core.BitcoinSerializer;
import org.bitcoinj.core.Transaction;
import org.tbk.bitcoin.zeromq.client.MessagePublisherFactory;
import reactor.core.publisher.Flux;
import static java.util.Objects.requireNonNull;
@Slf4j
public final class BitcoinjTransactionPublisherFactory implements MessagePublisherFactory {
private final BitcoinSerializer bitcoinSerializer;
private final MessagePublisherFactory delegate;
public BitcoinjTransactionPublisherFactory(BitcoinSerializer bitcoinSerializer, MessagePublisherFactory publisherFactory) {
this.bitcoinSerializer = requireNonNull(bitcoinSerializer);
this.delegate = requireNonNull(publisherFactory);
}
@Override
public String getTopicName() {
return delegate.getTopicName();
}
@Override
public Flux create() {
return delegate.create()
.map(bitcoinSerializer::makeTransaction);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy