public void unregisterAll() { for (MessageHandler messageHandler : myDeliveryHandlerSet) { unregister(messageHandler); } }
@Override public boolean loadSubscription(IBaseResource theResource) { return mySubscriptionRegistry.registerSubscriptionUnlessAlreadyRegistered(theResource); } }
public SubscribableChannel newDeliveryChannel(String theSubscriptionId, String theChannelType) { String channelName = "subscription-delivery-" + theChannelType + "-" + theSubscriptionId; return mySubscribableChannelFactory.createSubscribableChannel(channelName); }
/** * Create a @Primary @Bean if you need a different implementation */ @Bean public ISubscribableChannelFactory linkedBlockingQueueSubscribableChannelFactory() { return new LinkedBlockingQueueSubscribableChannelFactory(); }
public Optional<MessageHandler> createDeliveryHandler(CanonicalSubscription theSubscription) { if (theSubscription.getChannelType() == CanonicalSubscriptionChannelType.EMAIL) { return Optional.of(getSubscriptionDeliveringEmailSubscriber(myEmailSender)); } else if (theSubscription.getChannelType() == CanonicalSubscriptionChannelType.RESTHOOK) { return Optional.of(getSubscriptionDeliveringRestHookSubscriber()); } else { return Optional.empty(); } }
public BoundStaticSubscipriptionState(WebSocketSession theSession, ActiveSubscription theActiveSubscription) { mySession = theSession; myActiveSubscription = theActiveSubscription; theActiveSubscription.register(this); }
void unregisterAllSubscriptionsNotInCollection(Collection<String> theAllIds) { myActiveSubscriptionCache.unregisterAllSubscriptionsNotInCollection(theAllIds); }
public int size() { return myActiveSubscriptionCache.size(); }
public Collection<ActiveSubscription> getAll() { return myActiveSubscriptionCache.getAll(); }
public ActiveSubscription get(String theIdPart) { return myActiveSubscriptionCache.get(theIdPart); }
@VisibleForTesting public void clearForUnitTests() { myActiveSubscriptionCache.clearForUnitTests(); } }
@VisibleForTesting public int doSyncSubscriptionsForUnitTest() { return doSyncSubscriptionsWithRetry(); }
private void loadSubscriptions() { ourLog.info("Loading subscriptions into the SubscriptionRegistry..."); // Activate scheduled subscription loads into the SubscriptionRegistry myAppicationContext.getBean(SubscriptionLoader.class); ourLog.info("...{} subscriptions loaded", mySubscriptionRegistry.size()); }
public void remove(String theSubscriptionId) { Validate.notBlank(theSubscriptionId); ActiveSubscription activeSubscription = myCache.get(theSubscriptionId); if (activeSubscription == null) { return; } activeSubscription.unregisterAll(); myCache.remove(theSubscriptionId); }
public void unregisterSubscription(IIdType theId) { Validate.notNull(theId); String subscriptionId = theId.getIdPart(); myActiveSubscriptionCache.remove(subscriptionId); }
synchronized int doSyncSubscriptionsWithRetry() { Retrier<Integer> syncSubscriptionRetrier = new Retrier(() -> doSyncSubscriptions(), MAX_RETRIES, mySecondsBetweenRetries, "sync subscriptions"); return syncSubscriptionRetrier.runWithRetry(); }
private String getId(ActiveSubscription theActiveSubscription) { return theActiveSubscription.getIdElement(myFhirContext).toUnqualifiedVersionless().getValue(); }
@Bean public ISubscribableChannelFactory blockingQueueSubscriptionDeliveryChannelFactory() { return new LinkedBlockingQueueSubscribableChannelFactory(); } }
@Override public void closing() { myActiveSubscription.unregister(this); }
public SubscribableChannel newMatchingChannel(String theChannelName) { return mySubscribableChannelFactory.createSubscribableChannel(theChannelName); } }