com.quorum.tessera.recovery.workflow.SingleEncodedPayloadPublisher Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tessera-recover Show documentation
Show all versions of tessera-recover Show documentation
Tessera is a stateless Java system that is used to enable the encryption, decryption, and distribution of private transactions for Quorum.
package com.quorum.tessera.recovery.workflow;
import com.quorum.tessera.encryption.PublicKey;
import com.quorum.tessera.transaction.publish.PayloadPublisher;
import com.quorum.tessera.transaction.publish.PublishPayloadException;
import java.util.Objects;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class SingleEncodedPayloadPublisher implements BatchWorkflowAction {
private static final Logger LOGGER = LoggerFactory.getLogger(SingleEncodedPayloadPublisher.class);
private final PayloadPublisher payloadPublisher;
public SingleEncodedPayloadPublisher(final PayloadPublisher payloadPublisher) {
this.payloadPublisher = Objects.requireNonNull(payloadPublisher);
}
@Override
public boolean execute(final BatchWorkflowContext event) {
final PublicKey recipientKey = event.getRecipientKey();
return event.getPayloadsToPublish().stream()
.allMatch(
payload -> {
try {
payloadPublisher.publishPayload(payload, recipientKey);
return true;
} catch (final PublishPayloadException ex) {
LOGGER.warn(
"Unable to publish payload to recipient {} during resend",
recipientKey.encodeToBase64());
return false;
}
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy