use of com.yahoo.elide.graphql.subscriptions.hooks.SubscriptionScanner in project elide by yahoo.
the class TestBinder method configure.
@Override
protected void configure() {
EntityDictionary dictionary = EntityDictionary.builder().injector(injector::inject).build();
dictionary.scanForSecurityChecks();
bind(dictionary).to(EntityDictionary.class);
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(EMBEDDED_JMS_URL);
bind(connectionFactory).to(ConnectionFactory.class);
// Primary Elide instance for CRUD endpoints.
bindFactory(new Factory<Elide>() {
@Override
public Elide provide() {
HashMapDataStore inMemoryStore = new HashMapDataStore(Set.of(Book.class, Author.class, Publisher.class, ChatBot.class));
Elide elide = buildElide(inMemoryStore, dictionary);
elide.doScans();
SubscriptionScanner subscriptionScanner = SubscriptionScanner.builder().connectionFactory(connectionFactory).dictionary(elide.getElideSettings().getDictionary()).scanner(elide.getScanner()).build();
subscriptionScanner.bindLifecycleHooks();
return elide;
}
@Override
public void dispose(Elide elide) {
}
}).to(Elide.class).named("elide");
}
use of com.yahoo.elide.graphql.subscriptions.hooks.SubscriptionScanner in project elide by yahoo.
the class ElideSubscriptionScanningConfiguration method onStartOrRefresh.
@EventListener(value = { ContextRefreshedEvent.class, RefreshScopeRefreshedEvent.class })
public void onStartOrRefresh(ApplicationEvent event) {
Elide elide = refreshableElide.getElide();
SubscriptionScanner scanner = SubscriptionScanner.builder().deliveryDelay(Message.DEFAULT_DELIVERY_DELAY).messagePriority(Message.DEFAULT_PRIORITY).timeToLive(Message.DEFAULT_TIME_TO_LIVE).deliveryMode(Message.DEFAULT_DELIVERY_MODE).scanner(elide.getScanner()).dictionary(elide.getElideSettings().getDictionary()).connectionFactory(connectionFactory).build();
scanner.bindLifecycleHooks();
}
use of com.yahoo.elide.graphql.subscriptions.hooks.SubscriptionScanner in project elide by yahoo.
the class ElideStandaloneSubscriptionSettings method subscriptionScanner.
/**
* Returns the scanner that searches for subscription annotations and binds life cycle hooks for them.
* @param elide The elide instance.
* @param connectionFactory The JMS connection factory where subscription messages should be sent.
* @return The scanner.
*/
default SubscriptionScanner subscriptionScanner(Elide elide, ConnectionFactory connectionFactory) {
SubscriptionScanner scanner = SubscriptionScanner.builder().deliveryDelay(Message.DEFAULT_DELIVERY_DELAY).messagePriority(Message.DEFAULT_PRIORITY).timeToLive(Message.DEFAULT_TIME_TO_LIVE).deliveryMode(Message.DEFAULT_DELIVERY_MODE).scanner(elide.getScanner()).dictionary(elide.getElideSettings().getDictionary()).connectionFactory(connectionFactory).build();
scanner.bindLifecycleHooks();
return scanner;
}
Aggregations