Improve subscription procesing within a transaction
This commit is contained in:
parent
2edc9910e5
commit
7046d2fe94
|
@ -108,12 +108,10 @@ public class SubscriptionCheckingSubscriber extends BaseSubscriptionSubscriber {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// should just be one resource as it was filtered by the id
|
ourLog.info("Found match: queueing rest-hook notification for resource: {}", id.toUnqualifiedVersionless().getValue());
|
||||||
for (IBaseResource nextBase : results.getResources(0, results.size())) {
|
|
||||||
ourLog.info("Found match: queueing rest-hook notification for resource: {}", nextBase.getIdElement());
|
|
||||||
|
|
||||||
ResourceDeliveryMessage deliveryMsg = new ResourceDeliveryMessage();
|
ResourceDeliveryMessage deliveryMsg = new ResourceDeliveryMessage();
|
||||||
deliveryMsg.setPayload(getContext(), nextBase);
|
deliveryMsg.setPayload(getContext(), msg.getNewPayload(getContext()));
|
||||||
deliveryMsg.setSubscription(nextSubscription);
|
deliveryMsg.setSubscription(nextSubscription);
|
||||||
deliveryMsg.setOperationType(msg.getOperationType());
|
deliveryMsg.setOperationType(msg.getOperationType());
|
||||||
deliveryMsg.setPayloadId(msg.getId(getContext()));
|
deliveryMsg.setPayloadId(msg.getId(getContext()));
|
||||||
|
@ -121,7 +119,6 @@ public class SubscriptionCheckingSubscriber extends BaseSubscriptionSubscriber {
|
||||||
ResourceDeliveryJsonMessage wrappedMsg = new ResourceDeliveryJsonMessage(deliveryMsg);
|
ResourceDeliveryJsonMessage wrappedMsg = new ResourceDeliveryJsonMessage(deliveryMsg);
|
||||||
getSubscriptionInterceptor().getDeliveryChannel().send(wrappedMsg);
|
getSubscriptionInterceptor().getDeliveryChannel().send(wrappedMsg);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,8 +107,12 @@ public class StopWatch {
|
||||||
tgt.append(val);
|
tgt.append(val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param theNumOperations Ok for this to be 0, it will be treated as 1
|
||||||
|
*/
|
||||||
public int getMillisPerOperation(int theNumOperations) {
|
public int getMillisPerOperation(int theNumOperations) {
|
||||||
return (int)(((double) getMillis()) / Math.max(1.0, theNumOperations));
|
int numOperations = Math.min(1, theNumOperations);
|
||||||
|
return (int)(((double) getMillis()) / Math.max(1.0, numOperations));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue