@VisibleForTesting public void clearForUnitTests() { myActiveSubscriptionCache.clearForUnitTests(); } }
public ActiveSubscription get(String theIdPart) { return myActiveSubscriptionCache.get(theIdPart); }
public Collection<ActiveSubscription> getAll() { return myActiveSubscriptionCache.getAll(); }
public void unregisterAllSubscriptionsNotInCollection(Collection<String> theAllIds) { for (String next : new ArrayList<>(myCache.keySet())) { if (!theAllIds.contains(next)) { ourLog.info("Unregistering Subscription/{}", next); remove(next); } } }
void unregisterAllSubscriptionsNotInCollection(Collection<String> theAllIds) { myActiveSubscriptionCache.unregisterAllSubscriptionsNotInCollection(theAllIds); }
public int size() { return myActiveSubscriptionCache.size(); }
@SuppressWarnings("UnusedReturnValue") private CanonicalSubscription registerSubscription(IIdType theId, IBaseResource theSubscription) { Validate.notNull(theId); String subscriptionId = theId.getIdPart(); Validate.notBlank(subscriptionId); Validate.notNull(theSubscription); CanonicalSubscription canonicalized = mySubscriptionCanonicalizer.canonicalize(theSubscription); SubscribableChannel deliveryChannel; Optional<MessageHandler> deliveryHandler; if (myModelConfig.isSubscriptionMatchingEnabled()) { deliveryChannel = mySubscriptionDeliveryChannelFactory.newDeliveryChannel(subscriptionId, canonicalized.getChannelType().toCode().toLowerCase()); deliveryHandler = mySubscriptionDeliveryHandlerFactory.createDeliveryHandler(canonicalized); } else { deliveryChannel = null; deliveryHandler = Optional.empty(); } ActiveSubscription activeSubscription = new ActiveSubscription(canonicalized, deliveryChannel); deliveryHandler.ifPresent(activeSubscription::register); myActiveSubscriptionCache.put(subscriptionId, activeSubscription); // Interceptor call: SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED myInterceptorBroadcaster.callHooks(Pointcut.SUBSCRIPTION_AFTER_ACTIVE_SUBSCRIPTION_REGISTERED, canonicalized); return canonicalized; }
public void unregisterSubscription(IIdType theId) { Validate.notNull(theId); String subscriptionId = theId.getIdPart(); myActiveSubscriptionCache.remove(subscriptionId); }
private Optional<CanonicalSubscription> hasSubscription(IIdType theId) { Validate.notNull(theId); Validate.notBlank(theId.getIdPart()); Optional<ActiveSubscription> activeSubscription = Optional.ofNullable(myActiveSubscriptionCache.get(theId.getIdPart())); return activeSubscription.map(ActiveSubscription::getSubscription); }