Tweet Visualiser
This project visualises tweets related to specific topics. It's main purpose is to experiment with Azure's Cosmos DB.
This project
This project contains the following apps:
App | Purpose |
---|---|
TweetVisualiser.Listener | Console App that streams tweets related to specific topics and pushes them to Cosmos DB. |
TweetVisualiser.UI | Blazor Web App that uses Cosmos DB's Change Feed Processor to stream tweets and calculate metrics related to them on the fly. |
Getting started
All of the code is in the src
folder. It requires the dotnet 6 SDK to run.
Cosmos DB
For this project, it's recommended to use the Cosmos DB Emulator instead of an Azure Cosmos DB Container, as Azure Cosmos DB Containers aren't free to run. You can either install the emulator locally, or run a docker image containing the emulator following these steps.
Once you've set up a local emulator, set the following user secrets:
CosmosDB:Uri
(set to https://localhost:8081
if the emulator has been installed locally)
CosmosDB:PrimaryKey
Note - Databases/Containers are created when the TweetVisualiser.Listener app is started, not when the UI is started. This is because Databases/Containers cannot be created in the blazor DI lifecycle.
Twitter API
The TweetVisualiser.Listener
app required a Twitter Developer Account. If you don't have one, you can apply for access here.
Create a new app from the developer portal. As the app is only be reading data we only need the Consumer Key and Consumer Secret. Once you have these, set the following user secrets:
TweetListener:ConsumerKey
TweetListener:ConsumerSecret
Example secrets.json
{
"CosmosDB:Uri": "https://localhost:8081", // will be different is using Azure
"CosmosDB:PrimaryKey": "FROM LOCAL DB EMULATOR/AZURE",
"TweetListener:ConsumerKey": "FROM TWITTER PORTAL",
"TweetListener:ConsumerSecret": "FROM TWITTER PORTAL"
}