io.nats.streaming.SubscriptionOptions Java Examples
The following examples show how to use
io.nats.streaming.SubscriptionOptions.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NATSStreamObservableQueue.java From conductor with Apache License 2.0 | 6 votes |
@Override public void subscribe() { // do nothing if already subscribed if (subs != null) { return; } try { ensureConnected(); SubscriptionOptions subscriptionOptions = new SubscriptionOptions .Builder().durableName(durableName).build(); // Create subject/queue subscription if the queue has been provided if (StringUtils.isNotEmpty(queue)) { logger.info("No subscription. Creating a queue subscription. subject={}, queue={}", subject, queue); subs = conn.subscribe(subject, queue, msg -> onMessage(msg.getSubject(), msg.getData()), subscriptionOptions); } else { logger.info("No subscription. Creating a pub/sub subscription. subject={}", subject); subs = conn.subscribe(subject, msg -> onMessage(msg.getSubject(), msg.getData()), subscriptionOptions); } } catch (Exception ex) { logger.error("Subscription failed with " + ex.getMessage() + " for queueURI " + queueURI, ex); } }
Example #2
Source File: NatsStreamingTransporter.java From moleculer-java with MIT License | 4 votes |
/** * @return the subscriptionOptions */ public SubscriptionOptions getSubscriptionOptions() { return subscriptionOptions; }
Example #3
Source File: NatsStreamingTransporter.java From moleculer-java with MIT License | 2 votes |
/** * @param subscriptionOptions * the subscriptionOptions to set */ public void setSubscriptionOptions(SubscriptionOptions subscriptionOptions) { this.subscriptionOptions = subscriptionOptions; }