Ne zaboravite ocijeniti predavanje
Kako ispuniti upitnik i osvojiti vrijedne nagrade?
Ocjenjivanje predavanja kojima ste prisustvovali je moguće na dva
načina:
1. posjetite web stranicu http://www.msnetwork.ba/ evaluaciju vršite u
sklopu svog korisničkog profila.
2. ocijenite predavanja kroz konferencijske mobilne aplikacije koje su
dostupne za Windows 10, Android i iOS mobilne uređaje.
U oba slučaja potrebno je prijaviti se sa Microsoft Account ili Office 365
korisničkim računom sa kojim ste registrovali za učešće na konferenciji.
Ispunjavanjem upitnika, pomažete Microsoftu u organizaciji narednih konferencija
O predavaču
• Microsoft Windows Platform Development MVP since 2014
• Program Architect for Authority Partners Inc. since 2016
• .NET Enterprise Developer/Architect specializing on SOA
• Mobile Dev. and IoT Enthusiast /
- Blogger: canbilgin.wordpress.com
- Author: Mastering Cross-Platform Development with Xamarin (2016)
Agenda
• Service Fabric Overview
• Domain Architecture
• Optimizations
• Configuration
• Testability
• Environment / Deployment
Why use Service Fabric?
SERVICE FABRIC OVERVIEW
BRIEF HISTORY OF “WHY”
Data
REST API
Data
Data
Data
Identity
Compute Layer
Persistence
Data
Data
REST API
Data
Data
Data
Identity
Compute Layer
Persistence
Data
Services
Data
REST API
Data
Data
Data
Identity
Compute Layer
Persistence
Data
Stateless Web API
Compute Service Layer
Persistence
Data
CACHE
Web Application
Data
Data
Persistence
Stateless Web API
Data
Data
Data
Data
CACHE
Web Application
Data
Data
Web Application
Stateless Web API
Fabric
Data
Persistence
Data
Data
Data
Data
Data
BRIEF HISTORY OF “WHAT”
What is Service Fabric?
Persistence
Data
?
Data
Data
Monolith Applications
Web Application
Monolith
Business Logic
Data Access
Persistence
Service Oriented Architecture
Compute Service Layer
Persistence
Data
Web Application
Stateless Web API
Data
Data
SOA (Enhancements)
Compute Service Layer
Persistence
Data
Stateless Web API
CACHE
Web Application
Data
Data
Service Fabric
Compute Service Layer
Persistence
Data
Data
Data
Data
Data
Data
Stateless Web App
Service Fabric
Client Use-Case and Architectural Details
DOMAIN ARCHITECTURE
Restful Web Façade
API
Orchestration of low
level worker actors
with reliable storage
User Actor
Possible additional
actors for other
features / operations
?
Stateless actors are
used for DB access
User
Repo
Doc.
Repo
Event
Manager
?
?
?
Trans.
Repo
Events
Repo
?
1) Authenticating the User
API
3) Subscribe for Notif’s
Event
Manager
User Actor
Periodic data polling for
subscribers
2) User Actor Initialization
User
Repo
Doc.
Repo
Trans.
Repo
Events
Repo
1) Get Notifications
API
Service does not need to
connect to the DB to
provide required data.
2) Get Notifications
Event
Manager
User Actor
User
Repo
Doc.
Repo
Trans.
Repo
Events
Repo
Data is retrieved from
Reliable Storage
1) Update Notifications Intent
API
5) Publish Complete Event
2) Forward the Intent
Event
Manager
User Actor
User
Repo
Doc.
Repo
Trans.
Repo
Events
Repo
3) Dispatch Worker
4) Reminder to Self
Partitioning & Instancing
OPTIMIZATIONS
Partition Key = UserId % 4
API
User Actor
User Actor
User Actor
User Actor
User Actor
User Actor
User Actor
User Actor
Event
Manager
Event
Manager
Event
Manager
Events
Repo
Events
Repo
User Actor
User Actor
User
Repo
Event
Manager
User Actor
User Actor
Doc.
Repo
Trans.
Repo
Events
Repo
Events
Repo
Environment Dependent Configuration & Deployment
CONFIGURATION
/// <summary>
/// Get Service Fabric Settings from config.
/// </summary>
/// <param name="parameterName">Return settings for the parameter name</param>
/// <returns></returns>
private string GetConfigurationSetting(string parameterName)
{
var sections = _configurationSettings?.Sections;
if (sections?[_configurationSectionName] != null)
{
if (sections[_configurationSectionName].Parameters.Contains(parameterName))
{
return sections[_configurationSectionName].Parameters[parameterName].Value;
}
}
return null;
}
Testability Mocks, Extensions, Plugins
FABRIC EXTENSIONS
Unit Testing & Code Coverage
// Adding the service uri (e.g fabric:/RealtorDashboardApp/EventManagerService)
// Using the ServiceProxy class
var eventsManagerService = ServiceProxy.Create<IEventManager>(0, serviceUri);
return eventsManagerService.SaveNotificationAsDismissedAsync(
State.EventUpdatesSubscriptionId, eventId);
var eventsManager = this.ServiceProxyProvider
.Create<IEventManager>(0, new ServiceUriBuilder("EventManager").ToUri());
return eventsManager.SaveNotificationAsDismissedAsync(
State.EventUpdatesSubscriptionId, eventId);
// Defining the mock method which will updated the event data
Func<Guid, int, Task<bool>> updateEventId = (subId, eventId) =>
{
expectedNotificationBundle.EventData.First().IsDismissed = true;
return Task.FromResult(true);
};
// Setting up the instance for the events manager
var mockEventsService = new Mock<IEventManager>();
mockEventsService.Setup(instance =>
instance.SaveNotificationAsDismissedAsync(It.IsAny<Guid>(), It.IsAny<int>()))
.Returns((Guid paramGuid, int paramInt) => updateEventId(paramGuid, paramInt));
// Registering with the MockServiceProxyProvider
MockServiceProxyProvider serviceProxyProvider = new MockServiceProxyProvider();
serviceProxyProvider.Supports<IEventManager>(serviceUri => m_EventsManagerService.Object);
var userActor = new UserActor(actorProxyProvider, serviceProxyProvider);
Testability Framework & Load Testing
© Copyright 2026 Paperzz