AzureSBManagedConnection(AzureSBManagedConnectionFactory aThis, Subject subject, ConnectionRequestInfo cxRequestInfo) { cf = aThis; listeners = new HashSet<>(); SharedAccessSignatureTokenProvider tokenProvider = new SharedAccessSignatureTokenProvider(cf.getSasKeyName(), cf.getSasKey(), 60); try { sbConnector = new QueueClient(cf.getNameSpace(),cf.getQueueName(),new ClientSettings(tokenProvider, RetryPolicy.getDefault(), Duration.ofSeconds(cf.getTimeOut())),ReceiveMode.RECEIVEANDDELETE); } catch (InterruptedException | ServiceBusException ex) { Logger.getLogger(AzureSBManagedConnection.class.getName()).log(Level.SEVERE, null, ex); } }
AzureSBManagedConnection(AzureSBManagedConnectionFactory aThis, Subject subject, ConnectionRequestInfo cxRequestInfo) { cf = aThis; listeners = new HashSet<>(); SharedAccessSignatureTokenProvider tokenProvider = new SharedAccessSignatureTokenProvider(cf.getSasKeyName(), cf.getSasKey(), 60); try { sbConnector = new QueueClient(cf.getNameSpace(),cf.getQueueName(),new ClientSettings(tokenProvider, RetryPolicy.getDefault(), Duration.ofSeconds(cf.getTimeOut())),ReceiveMode.RECEIVEANDDELETE); } catch (InterruptedException | ServiceBusException ex) { Logger.getLogger(AzureSBManagedConnection.class.getName()).log(Level.SEVERE, null, ex); } }
@SuppressWarnings("deprecation") public static ClientSettings getClientSettingsFromConnectionStringBuilder(ConnectionStringBuilder builder) { TokenProvider tokenProvider; if(builder.getSharedAccessSignatureToken() == null) { tokenProvider = new SharedAccessSignatureTokenProvider(builder.getSasKeyName(), builder.getSasKey(), SecurityConstants.DEFAULT_SAS_TOKEN_VALIDITY_IN_SECONDS); } else { tokenProvider = new SharedAccessSignatureTokenProvider(builder.getSharedAccessSignatureToken(), Instant.now().plus(Duration.ofSeconds(SecurityConstants.DEFAULT_SAS_TOKEN_VALIDITY_IN_SECONDS))); } return new ClientSettings(tokenProvider, builder.getRetryPolicy(), builder.getOperationTimeout(), builder.getTransportType()); }
public AzureSBListener(AzureSBActivationSpec asbSpec, BootstrapContext context, MessageEndpointFactory endpointFactory) throws ResourceException { activationSpec = asbSpec; this.context = context; this.endpointFactory = endpointFactory; SharedAccessSignatureTokenProvider tokenProvider = new SharedAccessSignatureTokenProvider(asbSpec.getSasKeyName(), asbSpec.getSasKey(),60); ClientSettings settings = new ClientSettings(tokenProvider, RetryPolicy.getDefault(), Duration.ofSeconds(asbSpec.getPollTimeout())); try { client = new QueueClient(asbSpec.getNameSpace(), asbSpec.getQueueName(), settings, ReceiveMode.RECEIVEANDDELETE); client.setPrefetchCount(activationSpec.getPreFetchCount()); } catch (InterruptedException | ServiceBusException ex) { Logger.getLogger(AzureSBListener.class.getName()).log(Level.SEVERE, "Error creating listener for queue " + activationSpec.getQueueName(), ex); throw new ResourceException(ex); } }
public AzureSBListener(AzureSBActivationSpec asbSpec, BootstrapContext context, MessageEndpointFactory endpointFactory) throws ResourceException { activationSpec = asbSpec; this.context = context; this.endpointFactory = endpointFactory; SharedAccessSignatureTokenProvider tokenProvider = new SharedAccessSignatureTokenProvider(asbSpec.getSasKeyName(), asbSpec.getSasKey(),60); ClientSettings settings = new ClientSettings(tokenProvider, RetryPolicy.getDefault(), Duration.ofSeconds(asbSpec.getPollTimeout())); try { client = new QueueClient(asbSpec.getNameSpace(), asbSpec.getQueueName(), settings, ReceiveMode.RECEIVEANDDELETE); client.setPrefetchCount(activationSpec.getPreFetchCount()); } catch (InterruptedException | ServiceBusException ex) { Logger.getLogger(AzureSBListener.class.getName()).log(Level.SEVERE, "Error creating listener for queue " + activationSpec.getQueueName(), ex); throw new ResourceException(ex); } }