/// <summary>
 /// Get the registered implementation of <seealso cref="ISagaTypeNamingStrategy"/> or the default <seealso cref="DefaultSagaTypeNamingStrategy"/> if one is not configured
 /// </summary>
 static ISagaTypeNamingStrategy GetSagaTypeNamingStrategy(IResolutionContext resolutionContext, IRebusLoggerFactory rebusLoggerFactory)
 {
     if (resolutionContext.Has <ISagaTypeNamingStrategy>())
     {
         return(resolutionContext.Get <ISagaTypeNamingStrategy>());
     }
     return(new DefaultSagaTypeNamingStrategy());
 }
Пример #2
0
        public SnsAttributeMapperOutBoundStep(IResolutionContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            _snsAttributeMapperFactory = context.Get <ISnsAttributeMapperFactory>();
        }
    static IProducerImplementation RegisterProducerImplementation(IEnumerable <string> bootstrapServers, IResolutionContext c, KafkaProducerConfigurationBuilder builder)
    {
        var loggerFactory = c.Get <ILoggerFactory>();

        return(new KafkaProducerImplementation(
                   loggerFactory: loggerFactory,
                   address: string.Join(";", bootstrapServers),
                   configurationCustomizer: builder.Apply
                   ));
    }
Пример #4
0
 static ITransport GetTransport(IResolutionContext c)
 {
     try
     {
         return(c.Get <ITransport>());
     }
     catch (Exception exception)
     {
         throw new RebusApplicationException(exception, @"Could not get transport - did you call 'EnableSagaAuditing' on a one-way client? (which is not capable of receiving messages, and therefore can never get to change the stage of any saga instances...)");
     }
 }
 static ITransport GetTransport(IResolutionContext c)
 {
     try
     {
         return c.Get<ITransport>();
     }
     catch (Exception exception)
     {
         throw new RebusApplicationException(exception, @"Could not get transport - did you call 'EnableSagaAuditing' on a one-way client? (which is not capable of receiving messages, and therefore can never get to change the stage of any saga instances...)");
     }
 }
    /// <summary>
    /// Get the registered implementation of <seealso cref="ISagaTypeNamingStrategy"/> or the default <seealso cref="LegacySagaTypeNamingStrategy"/> if one is not configured
    /// </summary>
    static ISagaTypeNamingStrategy GetSagaTypeNamingStrategy(IResolutionContext resolutionContext, IRebusLoggerFactory rebusLoggerFactory)
    {
        if (resolutionContext.Has <ISagaTypeNamingStrategy>())
        {
            return(resolutionContext.Get <ISagaTypeNamingStrategy>());
        }

        var logger = rebusLoggerFactory.GetLogger <SqlServerSagaStorage>();

        logger.Debug($"An implementation of {nameof(ISagaTypeNamingStrategy)} was not registered. A default, backward compatible, implementation will be used ({nameof(LegacySagaTypeNamingStrategy)}).");

        return(new LegacySagaTypeNamingStrategy());
    }
Пример #7
0
        /// <summary>
        /// Get the registered implementation of <seealso cref="ISagaTypeNamingStrategy"/> or the default <seealso cref="LegacySagaTypeNamingStrategy"/> if one is not configured
        /// </summary>
        private static ISagaTypeNamingStrategy GetSagaTypeNamingStrategy(IResolutionContext resolutionContext, IRebusLoggerFactory rebusLoggerFactory)
        {
            ISagaTypeNamingStrategy sagaTypeNamingStrategy;

            if (resolutionContext.Has <ISagaTypeNamingStrategy>() == false)
            {
                rebusLoggerFactory.GetLogger <SqlServerSagaStorage>().Debug($"An implementation of {nameof(ISagaTypeNamingStrategy)} was not registered. A default, backward compatible, implementation will be used ({nameof(LegacySagaTypeNamingStrategy)}).");
                sagaTypeNamingStrategy = new LegacySagaTypeNamingStrategy();
            }
            else
            {
                sagaTypeNamingStrategy = resolutionContext.Get <ISagaTypeNamingStrategy>();
            }

            return(sagaTypeNamingStrategy);
        }
Пример #8
0
        static ISagaSnapshotStorage GetSagaSnapshotStorage(IResolutionContext c)
        {
            try
            {
                return(c.Get <ISagaSnapshotStorage>());
            }
            catch (Exception exception)
            {
                throw new RebusApplicationException(exception, @"Could not get saga snapshot storage - did you call 'EnableSagaAuditing' without choosing a way to store the snapshots?

When you enable the saving of saga data snapshots, you must specify how to save them - it can be done by making further calls after 'EnableSagaAuditing', e.g. like so:

Configure.With(..)
    .(...)
    .Options(o => o.EnableSagaAuditing().StoreInSqlServer(....))
    .(...)");
            }
        }
        static ISagaSnapshotStorage GetSagaSnapshotStorage(IResolutionContext c)
        {
            try
            {
                return c.Get<ISagaSnapshotStorage>();
            }
            catch (Exception exception)
            {
                throw new RebusApplicationException(exception, @"Could not get saga snapshot storage - did you call 'EnableSagaAuditing' without choosing a way to store the snapshots?

When you enable the saving of saga data snapshots, you must specify how to save them - it can be done by making further calls after 'EnableSagaAuditing', e.g. like so:

Configure.With(..)
    .(...)
    .Options(o => o.EnableSagaAuditing().StoreInSqlServer(....))
    .(...)");
            }
        }
Пример #10
0
        static IDataBusStorage GetDataBusStorage(IResolutionContext c)
        {
            try
            {
                return(c.Get <IDataBusStorage>());
            }
            catch (Exception exception)
            {
                throw new RebusApplicationException(exception, @"Could not get data bus storage - did you call 'EnableDataBus' without choosing a way to store the data?

When you enable the data bus, you must specify how to save data - it can be done by making further calls after 'EnableDataBus', e.g. like so:

Configure.With(..)
    .(...)
    .Options(o => o.EnableDataBus().StoreInSqlServer(....))
    .(...)");
            }
        }
Пример #11
0
        static IDataBusStorage GetDataBusStorage(IResolutionContext c)
        {
            try
            {
                return c.Get<IDataBusStorage>();
            }
            catch (Exception exception)
            {
                throw new RebusApplicationException(exception, @"Could not get data bus storage - did you call 'EnableDataBus' without choosing a way to store the data?

When you enable the data bus, you must specify how to save data - it can be done by making further calls after 'EnableDataBus', e.g. like so:

Configure.With(..)
    .(...)
    .Options(o => o.EnableDataBus().StoreInSqlServer(....))
    .(...)");

            }
        }