private void sendTopicMessage() throws ServiceBusException, InterruptedException { final String messageBody = "topic message"; System.out.println("Sending message: " + messageBody); final Message message = new Message(messageBody.getBytes(StandardCharsets.UTF_8)); topicClient.send(message); topicClient.close(); }
@Override public String getTopicName() { return this.getEntityPath(); } }
@Bean @Scope("prototype") @ConditionalOnMissingBean @ConditionalOnProperty(prefix = "azure.servicebus", value = "topic-name") public TopicClient topicClient() throws InterruptedException, ServiceBusException { return new TopicClient(new ConnectionStringBuilder(properties.getConnectionString(), properties.getTopicName())); }
@Bean @ConditionalOnMissingBean @ConditionalOnProperty(prefix = "azure.servicebus", value = "topic-name") public TopicClient topicClient() throws InterruptedException, ServiceBusException { return new TopicClient(new ConnectionStringBuilder(properties.getConnectionString(), properties.getTopicName())); }
@Bean @ConditionalOnMissingBean @ConditionalOnProperty(prefix = "azure.servicebus", value = "topic-name") public TopicClient topicClient() throws InterruptedException, ServiceBusException { trackCustomEvent(); return new TopicClient(new ConnectionStringBuilder(properties.getConnectionString(), properties.getTopicName())); }
@Bean @ConditionalOnMissingBean @ConditionalOnProperty(prefix = "azure.servicebus", value = "topic-name") public TopicClient topicClient() throws InterruptedException, ServiceBusException { trackCustomEvent(); return new TopicClient(new ConnectionStringBuilder(properties.getConnectionString(), properties.getTopicName())); }
private IMessageSender createTopicClient(String topicName) { if (resourceManagerProvider != null && StringUtils.hasText(namespace)) { ServiceBusNamespace serviceBusNamespace = resourceManagerProvider.getServiceBusNamespaceManager().getOrCreate(namespace); resourceManagerProvider.getServiceBusTopicManager().getOrCreate(Tuple.of(serviceBusNamespace, topicName)); } try { return new TopicClient(new ConnectionStringBuilder(connectionString, topicName)); } catch (InterruptedException | ServiceBusException e) { throw new ServiceBusRuntimeException("Failed to create service bus topic client", e); } }
private IMessageSender createTopicClient(String topicName) { if (resourceManagerProvider != null && StringUtils.hasText(namespace)) { ServiceBusNamespace serviceBusNamespace = resourceManagerProvider.getServiceBusNamespaceManager().getOrCreate(namespace); resourceManagerProvider.getServiceBusTopicManager().getOrCreate(Tuple.of(serviceBusNamespace, topicName)); } try { return new TopicClient(new ConnectionStringBuilder(connectionString, topicName)); } catch (InterruptedException | ServiceBusException e) { throw new ServiceBusRuntimeException("Failed to create service bus topic client", e); } }