private List<DatabusSubscription> createSubscriptions(List<String> sources) throws DatabusClientException { List<DatabusSubscription> subs = null; try { subs = DatabusSubscription.createFromUriList(sources); } catch (Exception ex) { throw new DatabusClientException(ex); } return subs; }
/** * Factory method to create sources connection * * @param connConfig * @param subs * @param candidateRelays * @param candidateBootstrapServers * @param eventBuffer * @param bootstrapBuffer * @return */ protected synchronized DatabusSourcesConnection createConnection( StaticConfig connConfig, List<DatabusSubscription> subs, Set<ServerInfo> candidateRelays, Set<ServerInfo> candidateBootstrapServers, DbusEventBuffer eventBuffer, DbusEventBuffer bootstrapBuffer) { _log.info( "Creating Sources Connection : Candidate Relays :" + candidateRelays + ", CandidateBootstrapServers :" + candidateBootstrapServers + ", Subscriptions :" + subs); ConnectionStateFactory connStateFactory = new ConnectionStateFactory(DatabusSubscription.getStrList(subs)); DatabusSourcesConnection sourcesConnection = new DatabusSourcesConnection( connConfig, subs, candidateRelays, candidateBootstrapServers, _streamConsumerRawRegistrations, _bootstrapConsumerRawRegistrations, eventBuffer, bootstrapBuffer, _client.getDefaultExecutorService(), _client.getContainerStatsCollector(), _inboundEventsStatsCollector, _bootstrapEventsStatsCollector, _relayConsumerStats, _bootstrapConsumerStats, _unifiedClientStats, _checkpointPersistenceProvider, _client.getRelayConnFactory(), _client.getBootstrapConnFactory(), _client.getHttpStatsCollector(), null, // This should make sure the checkpoint directory structure is compatible with V2. _client, _id.toString(), // Used to uniquely identify logs and mbean name _client.getEventFactory(), null, connStateFactory); return sourcesConnection; }
@Override public Collection<DatabusSubscription> getSubscriptions() { return DatabusSubscription.createSubscriptionList(_sources); }