var builder = DistributedApplication.CreateBuilder(args);
var storage = builder.AddAzureStorage("storage").RunAsEmulator();
var queue = storage.AddQueues("queue");
var blob = storage.AddBlobs("blob");
var eventHubs = builder.AddAzureEventHubs("eventhubs").UseExisting().AddEventHub("myhub");
var serviceBus = builder.AddAzureServiceBus("messaging").UseExisting().WithQueue("myqueue");Note
The details shared here are based on the prototyping done as of 2/3/2024. If you're reading this gist at a later time, the details might have changed. In any case, it's here for archival reasons.
This gist is written in response to a tweet by Adam Storr (@WestDiscGolf) in response to a code sample that was shared of the current prototype of our workstream to sharpen up event-based apps.
Sure. The "with provider" and "map events" methods, how they work together and are processed under the hood. For example when/how a message arrives and triggers the binding/handler. Thanks for your reply :-)
The prototype code looks like this:
| using System.Net; | |
| using System.Text; | |
| var port = 8080; | |
| var server = new Server(port); | |
| server.UseAuthentication(); | |
| server.UseRouting(); | |
| server.UseNotFoundPage(); | 
- Damian Edward's Minimal Playground: https://github.com/DamianEdwards/MinimalApiPlayground
- Contoso Construction API with Azure Deployment Scripts: https://github.com/bradygaster/Contoso.Construction
- .NET Conf 2021 Demo App: https://github.com/halter73/Contoso.Construction
| make: Entering directory '/home/captainsafia/github.com/dotnet/runtime/src/mono/wasm' | |
| /home/captainsafia/github.com/dotnet/runtime/dotnet.sh build --configuration debug --nologo /p:TargetArchitecture=wasm /p:TargetOS=Browser /p:Configuration=Debug /p:RuntimeConfiguration=Release /home/captainsafia/github.com/dotnet/runtime/src/mono/wasm/debugger/tests/debugger-test | |
| Determining projects to restore... | |
| All projects are up-to-date for restore. | |
| Determining projects to restore... | |
| All projects are up-to-date for restore. | |
| WasmAppBuilder -> /home/captainsafia/github.com/dotnet/runtime/artifacts/bin/WasmAppBuilder/Debug/net5.0/WasmAppBuilder.dll | |
| WasmAppBuilder -> /home/captainsafia/github.com/dotnet/runtime/artifacts/bin/WasmAppBuilder/Debug/net5.0/publish/ | |
| debugger-test -> /home/captainsafia/github.com/dotnet/runtime/artifacts/bin/debugger-test/wasm/Debug/debugger-test.dll | 
| ã ÏΩ`$YY/>=3;≥3ô˜˚π€Û⁄I≤ìÓŒ£ìÃÑ:ùN¶ôºHw2+Œ⁄V∫+IÌTW5U’yÃ≤¿" Ëe—ã¢"EPƒ'ˇ{UTƒr≈+ | |
| xˇ»S\‰≠ÇäWÓy’˚‘©Í$›]=ª∞ªIͺæsŒÔ˚ŒwæÛùÔÏ⁄≤eK€Cs√Ç4./é | |
| "?ÕiK≈gU^Q„EÆ¢qǧr_ÊaA(rö Kj|X‰Ó»©ëë˘û‚í¨jÒØÄÒ≤:_ƒRl^êDyÒøæ˜ΩÔÌGˇ˘û◊"{@”ú≤Z_‰ïüyÈÊî¡O‹ª5“ˆ–±tUQxIõÕ¶´¢VU¯áx©k6WsùÉ?•◊È€7©ã™ßh|)y Ú8≠Û¯\.=5í)åeÛÖTÓ∆t*ó+LÇkÒT•"›û‘*'FsZµ$»—¥\‚c\•OÀíHU„£ | |
| WÊWdÂ∂áâ—κX·ïh˚/ïxÖW:ÏŸ'∏‚TŒ#ÁÖâ¢v\ÊJBQëUyAÀs "Ø©3<Wö탵ÌöRÂ#ÖÁ–ÊkQ–ñ™Û±¢\éódM‚µ8ßV¿è¢¨Ò˘ÑÏzx:]OçÂ∂%V€¶s›üå¥õπ;¢óFª¯XEëÀ≠PSQ( ¢¨®fl_`y‰Ò«/Ω¯“¬ÓKèÌΩÙ¯•ˆÓûπÃN…Ω,(=^Z~‰ÒK›=Àó¢±éKÌœÒ è?]S´≈"Ø™è<ÓìèWYy‰Ò;•`Æ5ûdÕ.D∑èß&«⁄x©0õãÕÊGª˜LŒM“#x ∂vΩH>33QòûôõIMÊ23πÏ‘‰éÓXfl@¨˜¿»T~2ì/\ü ”©¸ı | |
| }zj|j∂∏Œ%Í—˛Ù‘‰H™êæÕÄ…ÿ*…˜‰Æg∆«ÔçæäflQóvéOçM¶&2{¨ÕÇ<„s„ëfi˚çÈÒl!üœLdÚ3flW»er∞Ÿëã=•~`a`æ´Øßo°´Ø/¡u]MÙp]Ω|i†o`∞ƒœóv‰'¶G≤3›ÒeNâ/»b ˆ±‘_Ë}°tµwMÍÔª3∏ÿ/ˆı]]],™} øE)ûèü®ùÕéè‰S3cô¸‘l~z6àÀNé!∞Ó'®Œç‹P°®ππÓÒSK∑„…X"÷ùHt)≈Xw¨'—óËçu_çÁJ∑’623SS˘¡ı∂±"c8;ŸC´ &-ó°PTë`ê «óª˚bÄ$8KßÊ≤3˘Ÿ‘x!39W…ÊR√„à©âȸ÷Óû6ãòyAmfÜW™"?Û´‡+¶ t(^Tÿè€NUcÍ“ 2≥„˘Ïxf.3^üö∫1;IϱÇ|«≤Z | 
- 
Create a new Blazor WASM application from the CLI using dotnet new blazorwasm -o Scenario0
- 
Open the "Scenario0" directory in VS Code. 
- 
Navigate to the "Debug" section on the left. Then, click "create a launch.json file". In the window that pops up, select "Blazor WebAssembly Debug".   
- 
A new launch.jsonfile should be created with the following contents.
| {"timestamp":1589821464413,"tag":"runtime.welcome","level":1,"message":"js-debug-nightly v2020.5.1517 started","metadata":{"os":"darwin x64","nodeVersion":"v12.8.1","adapterVersion":"2020.5.1517"}} | |
| {"tag":"dap.receive","timestamp":1589821464390,"metadata":{"connectionId":2,"message":{"command":"initialize","arguments":{"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"pwa-chrome","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us","supportsProgressReporting":true},"type":"request","seq":1}},"level":0} | |
| {"tag":"dap.send","timestamp":1589821464391,"metadata":{"connectionId":2,"message":{"seq":1,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConfigurationDoneRequest":true,"supportsFunctionBreakpoints":false,"supportsConditionalBreakpoints":true,"supportsHitConditionalBreakpoints":true,"supportsEvaluateForHovers":true,"exceptionBreakpo | 
| /** Launch a new kernel when the app host token changes. **/ | |
| const launchKernelWhenTokenChanged = (action$, state$) => | |
| // Whenever a new kernel is launched we execute this logic | |
| action$.pipe(ofType("LAUNCH_KERNEL_SUCCESSFUL"), | |
| switchMap((action) => | |
| // We subscribe to the StateObservable, which is a stream of changes to the Redux state | |
| state$.pipe( | |
| // We pull out the property we care about, the token field in the core state | |
| pluck("app", "host", "token"), | |
| // We only move on to the next step if it has changed https://www.learnrxjs.io/operators/filtering/distinctuntilchanged.html |