Giter Site home page Giter Site logo

foundatiofx / foundatio Goto Github PK

View Code? Open in Web Editor NEW
1.9K 1.9K 242.0 5.29 MB

Pluggable foundation blocks for building distributed apps.

License: Apache License 2.0

C# 99.83% PowerShell 0.17%
abstractions aws azure c-sharp distributed distributed-locks distributed-systems foundatio job-scheduler jobs lock logging message-bus messaging metrics queue redis s3 statsd storage

foundatio's People

Contributors

akshay-zz avatar ankrhesehus avatar dependabot-preview[bot] avatar derekpitt avatar edwardmeng avatar ejsmith avatar garcipat avatar itai-langer-cobwebs avatar jcono avatar leon99 avatar lynnroth avatar moswald avatar naishx avatar niemyjski avatar nj avatar onuralp avatar orthographic-pedant avatar pje-cloudbuy avatar pwelter34 avatar raiseandfall avatar rerikson avatar rozifus avatar rsheasby avatar seadoo2017 avatar seanfeldman avatar slolife avatar surgicalcoder avatar tonymobster avatar tyrrrz avatar wgraham17 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

foundatio's Issues

How can i use Foundatio.Lock?

It's like this ?

somecode to get lockprovider

   var rediscco = new RedisCacheClientOptions() { ConnectionMultiplexer = muxer };

 _lockProvider = new CacheLockProvider(new RedisCacheClient(rediscco), new RedisMessageBus(new RedisMessageBusOptions() { Subscriber = rediscco.ConnectionMultiplexer.GetSubscriber() }));

some code to get lock

 public static  async Task<ILock> AcquireAsync(string name,
        TimeSpan? lockTimeout = null,
        CancellationToken cancellationToken = default(CancellationToken),
        bool continueOnCapturedContext = false)
    {
        var @lock = await _lockProvider.AcquireAsync(name, lockTimeout, cancellationToken)
            .ConfigureAwait(continueOnCapturedContext);
        return @lock;
    }

user lock

  var l = LockHelper.AcquireAsync(key, TimeSpan.FromSeconds(5)).Result ;   
  ............my code to process stock............
  l.ReleaseAsync();

MessageBus Subscriptions

Hey,

Great foundations here. I'd be tempted to use this for a project i'm working on (which currently just uses the standard ServiceBus nuget) however we're using the Topics and Subscription functionality.

The AzureServiceBusMessageBus implementation uses the subscription to determine the channel to push to the multiple subscribers however there doesn't seem to be a way to listen to individual subscriptions being exposed. Would there be any interest in this functionality being added?

Race condition in AzureServiceBusQueue when multiple processes are creating the same queue

Right now, EnsureQueueCreatedAsync will check if the queue exists, and then if not, it will try to create it. If another process creates the queue in-between these two calls, then the create fails with a MessagingEntityAlreadyExistsException. This is caught and handled and works fine.

However, there's a catch - if another process is currently creating the queue, then it will fail with MessagingException, which is not caught.

The error seen in logs is:

Microsoft.ServiceBus.Messaging.MessagingException: The remote server returned an error: (409) Conflict. SubCode=40901. Another conflicting operation is in progress.

Since MessagingEntityAlreadyExistsException derives from MessagingException, the solution is to catch MessagingException instead.

Create strong named nuget packages

Would it be possible for you to publish strong named nuget packages which foundation depdending on strong named/signed package when they are available, for instance StackExchange.Redis.StrongName. This would be helpful for using Foundation along other packages such as SignalR.Redis.

I hope you will consider doing this.

Support Aliyun OSS storage

Recently when deploying exceptionless, in order to improve the scale out ability, we want to make use of cloud storage. Currently the Foundatio only support windows azure, but the Aliyun is with higher efficiency in China.
When we want to request pr to implement the adapter between Foundation and Aliyun OSS, there is no project for this purpose, and we don't know how to request pr for it.

Automatic lock renewal in QueueProcessorJobBase

We've recently added the ability to renew the lock on the queue entry.

It would be great if we could (optionally) do this automatically in QueueProcessorJobBase for long running processes. The alternative would be to pass the queue entry around everywhere to renew - including in scenarios where you don't care if the code has been triggered from a queue or otherwise.

[Caching] GetAllByPrefix like method

I'm trying to cache an ecommerce cart items using InMemoryCacheClient (dev) and in the future RedisCacheClient.
My key is in the form S{sessionId}-V{productId} and the value contains a CartItem object (quantity and other related data)
Adding and removing items are working great but i need to retrieve all the items for a sessionId.
I know the existance of using the Set but i needed the lines separated.
Is there a way to perform this? Maybe by using the ScopedCacheClient (i've done it with InMemoryCacheClient through the Keys prop but it will not work on RedisCacheClient)

Queue Management Improvements

Our current implementation of IQueue has a DeleteQueueAsync method which actually recreates the queue.

This clearly isn't expected behaviour (meaning we can't delete the queue easily in the test tear town) and in addition, we are also performing remote calls in the constructor of the queue which isn't ideal.

We could introduce an additional interface to manage the queues, although we'd have to specifically create every queue and inject it into the container - and the bootstrapper class therefore must ideally be async compatible.

public interface IQueueManager<TQueue> where TQueue : IQueue<T> {
    Task<TQueue> CreateQueueAsync(string queueName /* other params */);
    Task<bool> QueueExistsAsync(string queueName);
    Task DeleteQueueAsync(string queueName);
}

A big down side to this would be it would also make it more difficult to specify additional constructor params for the queue (as used in AzureStorageQueue to control poll interval).

Replace Metrics.Net with AppMetrics

The library Metrics.Net is only available for netfx and only can be deployed on windows servers. But the Foundatio currently supports netstandard 2.0, the Metrics.Net should be replaced with AppMetrics which supports netstandard, so that we can deployed on linux or unix.

Inconsistent stream handling on IFileStorage.SaveFile() implementations

The FolderFileStorage class calls stream.Seek(0, SeekOrigin.Begin) on the passed stream before copying the contents to the file stream. While this might be convenient (in some cases), it is inconsistent with the other implementations of IFileStream (InMemoryStream and AzureFileStream). And it seems presumptive to assume the caller did not positioned the stream correctly for the save operation and to "fix it for them". I can't think of any stream handling functions that do this - including the underlying ones called by these classes: Stream.CopyTo() and CloudBlockBlob.UploadFromStream().

My recommendation is to remove the Seek() operation.

Race condition in Azure Service Bus queue

As mentioned by @moswald in #38 ...

  1. In parallel, Thread A calls EnqueueAsync() and Thread B calls DeleteQueueAsync()
  2. Thread A passes through EnsureQueueCreatedAsync(), ensuring _queueClient is not null
  3. Thread B deletes the queue, setting _queueClient to null
  4. Thread A tries to use _queueCleint which is now null

There's not really a nice way to handle this without locking. Couple of solutions:

Option 1

Wrap _queueClient in a property which throws a slightly different exception, leaving the user to retry.

Option 2

Implement retry logic (preferably in QueueBase).

Add support for DefaultMessageTimeToLive and AutoDeleteOnIdle in AzureServiceBusQueue

Obviously there are many more "Azure ServiceBus Queue" specific properties that are unsupported, but these 2 are the ones I need right now. Do you guys have a strategy for how you might support these types of properties moving forward?

I started to do a pull request to set the properties via the constructor, but bolting on properties piecemeal seems like an unsustainable strategy.

Create async initialization method for AzureServiceBusQueue.

A lot of the Microsoft.ServiceBus.NamespaceManager methods called in the AzureServiceBusQueue constructor have async counterparts. Since constructors can't be async, I propose deprecating the current constructor (shakes fist at semver) and adding a new private one that does very little. Then introduce a new factory method: static async Task<AzureServiceBusQueue> factory method that does all the same work the current constructor does synchronously.

i want override some methods of messagebusbase

in my case i both use java and .net ,in the messagebusbase class ,
field: _knownMessageTypesCache
method: GetMessageBodyType,SendMessageToSubscribers
in java the type is different from .net
so i want create an attribute in both java and .net ,use the _knownMessageTypesCache to mapping the type to class in java and to type in .net .

please change field protected and methods virtual,thanks

the code is in https://github.com/FoundatioFx/Foundatio/blob/master/src/Foundatio/Messaging/MessageBusBase.cs

Feature - Bulk Messaging

The current implementations of messaging use message pumps with callbacks which is not as efficient as bulk requesting in some circumstances. High volume scenarios should be bulk fetching to reduce costs as well since you are charged per request.

Publish and subscribe should ideally have corresponding bulk overload/versions as well.

NuGet Package Error

Hi all!,
I'm trying to install package on project with .NET 4.5.2. and when

Install-Package Foundatio -Version 4.2.1183

I've this error

Executing nuget actions took 1,94 sec
Install-Package : Could not install package 'Foundatio 4.2.1183'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly 
references or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:1
+ Install-Package Foundatio -Version 4.2.1183
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Why?

Idea: It would be handy to have an Events component

Similar to the logging and metrics (probably), it would be useful to have an eventqueue that all of your classes/methods publish to (in the situations where someone initializes it). Then subscribers of the event queue could listen for certain events and perform actions based on it.

This concept could basically leverage existing components you have already. And I haven't looked at your all of your code yet, but maybe this is how your metrics already works.

The use case for this would be something like a Job that subscribes for all SaveFile events... and as soon as it happens, it runs a command. But that same Job may run for DeleteFile events. And so, it can just subscribe to that event too. I know this feature is something that easily could be built into a custom project utilizing other foundatio components. However, I think it would be great to be a foundational pipeline used by your framework.

RedisMessageBus there is no effect


IMessageBus messageBus = new RedisMessageBus(new RedisMessageBusOptions
{
    Subscriber = connectionMultiplexer.GetSubscriber()
});

await messageBus.SubscribeAsync<SimpleMessage>(msg =>
{
    Console.WriteLine(msg.Data);
});

await messageBus.PublishAsync(new SimpleMessage { Data = "Hello" });

Using Fondatio with .net 4.5.2

I'm looking to be able to use some of the great functionality that I just found in the Foundatio library.

However, we have an application that we currently support on .net 4.5.2. It seems that a few months ago there was a change that Foundatio only supports 4.6 and later.

Is my only choice to use v4.1? Any plans to backport fixes to this branch for people who can't move ahead to 4.6 at this time?

Thanks.

Create strong name nuget packages

Would it be possible to create strong name versions of the nuget packages? I am using Signal.Redis which has a dependency on StackExchange.Redis.StrongName while Foundation.Redis has a dependency on StackExchange.Redis. I can build the Foundation solution with the proper dependency but I would imagine I am not the only one having this issue and the community could benefit from such strong named nuget packages. Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.