getActiveBrokerDefaultConnector function

ActiveBrokerInterface getActiveBrokerDefaultConnector(
  1. AuthenticationManager authManager, {
  2. Map<String, dynamic> args = const <String, dynamic>{},
})

Creates a new BrokerAmqpConnector.

The instance is created with the authManager and the optional constructor arguments in the args (the string-keys should match the name of the parameters).

This is needed to use the same interface on web and other platforms.

The args have defaults for the normal message communication in the S3I:

  • brokerHost = 'rabbitmq.s3i.vswf.dev',
  • port = 5672,
  • virtualHost = 's3i',
  • maxConnectionAttempts = 3,
  • reconnectWaitTime = const Duration(milliseconds: 1500),
  • prefetchCount = -1,
  • exchangeName = 'demo.direct',
  • exchangeType = ExchangeType.DIRECT

Implementation

ActiveBrokerInterface getActiveBrokerDefaultConnector(
    AuthenticationManager authManager,
    {Map<String, dynamic> args = const <String, dynamic>{}}) {
  final String brokerHost =
      args['brokerHost'] as String? ?? 'rabbitmq.s3i.vswf.dev';
  final int port = args['port'] as int? ?? 5672;
  final String virtualHost = args['virtualHost'] as String? ?? 's3i';
  final int maxConnectionAttempts = args['maxConnectionAttempts'] as int? ?? 3;
  final Duration reconnectWaitTime = args['reconnectWaitTime'] as Duration? ??
      const Duration(milliseconds: 1500);
  final int prefetchCount = args['prefetchCount'] as int? ?? -1;
  final String exchangeName = args['exchangeName'] as String? ?? 'demo.direct';
  final ExchangeType exchangeType =
      args['exchangeType'] as ExchangeType? ?? ExchangeType.DIRECT;

  return BrokerAmqpConnector(authManager,
      brokerHost: brokerHost,
      port: port,
      virtualHost: virtualHost,
      maxConnectionAttempts: maxConnectionAttempts,
      reconnectWaitTime: reconnectWaitTime,
      prefetchCount: prefetchCount,
      exchangeName: exchangeName,
      exchangeType: exchangeType);
}