Skip to content

Commit

Permalink
feat: add correlationId to ContractAgreementVerificationMessage and C…
Browse files Browse the repository at this point in the history
…ontractNegotiationEventMessage
  • Loading branch information
juliapampus committed Mar 22, 2023
1 parent d407174 commit c1175c8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ private boolean processConsumerVerifying(ContractNegotiation negotiation) {
var message = ContractAgreementVerificationMessage.Builder.newInstance()
.protocol(negotiation.getProtocol())
.connectorAddress(negotiation.getCounterPartyAddress())
.correlationId(negotiation.getId())
.build();

return entityRetryProcessFactory.doAsyncProcess(negotiation, () -> dispatcherRegistry.send(Object.class, message))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ private boolean processProviderFinalizing(ContractNegotiation negotiation) {
.type(ContractNegotiationEventMessage.Type.FINALIZED)
.protocol(negotiation.getProtocol())
.connectorAddress(negotiation.getCounterPartyAddress())
.correlationId(negotiation.getCorrelationId())
.build();

return entityRetryProcessFactory.doAsyncProcess(negotiation, () -> dispatcherRegistry.send(Object.class, message))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ContractAgreementVerificationMessage implements RemoteMessage {

private String protocol;
private String connectorAddress;
private String correlationId;

@Override
public String getProtocol() {
Expand All @@ -33,6 +34,10 @@ public String getConnectorAddress() {
return connectorAddress;
}

public String getCorrelationId() {
return correlationId;
}

public static class Builder {
private final ContractAgreementVerificationMessage message;

Expand All @@ -54,9 +59,15 @@ public Builder connectorAddress(String connectorAddress) {
return this;
}

public Builder correlationId(String correlationId) {
this.message.correlationId = correlationId;
return this;
}

public ContractAgreementVerificationMessage build() {
Objects.requireNonNull(message.protocol, "protocol");
Objects.requireNonNull(message.connectorAddress, "connectorAddress");
Objects.requireNonNull(message.correlationId, "correlationId");
return message;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class ContractNegotiationEventMessage implements RemoteMessage {

private String protocol;
private String connectorAddress;
private String correlationId;
private Type type;

@Override
Expand All @@ -34,6 +35,10 @@ public String getConnectorAddress() {
return connectorAddress;
}

public String getCorrelationId() {
return correlationId;
}

public Type getType() {
return type;
}
Expand All @@ -59,6 +64,11 @@ public Builder connectorAddress(String connectorAddress) {
return this;
}

public Builder correlationId(String correlationId) {
this.message.correlationId = correlationId;
return this;
}

public Builder type(Type type) {
this.message.type = type;
return this;
Expand All @@ -67,6 +77,7 @@ public Builder type(Type type) {
public ContractNegotiationEventMessage build() {
Objects.requireNonNull(message.protocol, "protocol");
Objects.requireNonNull(message.connectorAddress, "connectorAddress");
Objects.requireNonNull(message.correlationId, "correlationId");
Objects.requireNonNull(message.type, "type");
return message;
}
Expand Down

0 comments on commit c1175c8

Please sign in to comment.