Giter VIP home page Giter VIP logo

foundatio.samples's Introduction

Foundatio

Slack Status

A sample application that shows off some of the features of Foundatio. For all of the examples below, please take a look at the JavaScript console (Press F12 now) for client side messages via SignalR.

By default this example will use the in memory versions of Foundatio. In memory versions do not scale across processes or persist information across application restarts. To scale out out this example, please uncomment the RedisConnectionString in the web.config and ensure redis is installed.

Examples

To get started with the examples, please clone this repository and set the Web project as the startup project. Then press F5 to start debugging!

1. Caching

Attempt to get a guid from the cache. If the value is not cached the value will be populated after 5 seconds. This code makes a call to the ValuesController Get controller action

2. Jobs, Message Bus, Queues, Caching

Posts a guid to the ValuesController, this will save a file to storage with a new guid and enqueue a work item to a dedicated job (ValuesPostJob). This job will then dequeue the item and read the guid from storage and parse it. If it can be parsed it will be persisted to the cache and publish a notification on the message bus.

When you call Post Value you can then Get Value button to get the updated guid that was processed from the ValuesPostJob. Clicking this button multiple times will trigger the jobs to run multiple times and will also increment the metrics (visible from the debug window when running in memory versions).

This example shows off how jobs, queues, and the message bus work together.

3. Shared Jobs, Message Bus, Queues, Caching

Deletes an id from the cache by calling the ValuesController Delete controller action. Which enqueues a shared job work item (DeleteValueWorkItemHandler). Unlike dedicated jobs which are processing one job type, shared jobs can handle different job types and process them at anytime. This is great when you have long running tasks that don't happen very often, such as deleting an entity with many children.

The nice thing about shared jobs is that you can easily report the progress via the messagebus by calling the context.ReportProgress(percent, message);

Please note that if you are seeing duplicated messages reported to the console, this is because there are two instances of the shared jobs running. To fix this, you'll need to open the DeleteValueWorkItemHandler in the Core project and uncomment GetWorkItemLock to add locking to this job.

foundatio.samples's People

Contributors

ejsmith avatar niemyjski avatar

Watchers

 avatar  avatar

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.