SlideShare a Scribd company logo
1 of 90
NServiceBus and 
WCF Integration 
101 
October 10, 2014 
By Rich Helton
Why NServiceBus? 
 NServiceBus (NSB) is the most popular ESB for the 
C# platform in existence. 
 It is decentralized and has many tools to assist in 
deployment. 
 Many people may wonder the need to use an 
ESB? 
It is to manage services for any applications not 
performing in the website.
Source code 
My test source code can be found at 
https://github.com/richhelton 
Particular samples and souce code can be found at 
https://github.com/Particular
For those that don't use 
ESBs.... 
You may see many websites that say “Don't refresh this 
page” for instance as they are website only centric that 
may not consider an ESB. 
 You may also talk to some of their staff to know that they 
do not acknowledge that server and network errors can 
occur. 
 For those who want to monitor their services, 
transactions, messages, and give your website the ability 
to refresh a page after you enter a credit card, we have 
NSB.
What is a Service-Oriented 
Architecture 
SOA is a combination of design patterns, usually 
implemented through frameworks. 
SOA combines distinct services that are 
communicated through messages to cooperate as 
a single end-to-end business system. A service 
could be considered a Windows service, or a 
distinct unit of work, such as a mainframe job.
SOA Visual
More SOA Advantages 
By using services, we may start/stop services 
based on performance. 
 We may get running totals on the number of 
successful and error messages.
What is a Enterprise Service 
Bus (ESB)? 
ESB is a software architecture design model in 
which a common bus is shared across a framework 
to allow common agreed upon communication 
between different endpoints or services.
An ESB Visual
Software Quality 
Software Quality are cross-cutting features of the 
software, that normally defines the technical 
requirements of the software itself. 
These qualities are usually security, re-use, 
maintainability, reliability, efficiency, and other 
characteristics that make one want to use the 
framework. 
Notice that NSB match these qualities one-to-one.
SOA and ESBs to the rescue 
In the Microsoft world, when discussing a 
framework that implements Service Oriented 
Architecture (SOA), one may think of the Windows 
Communication Foundation (WCF) web services.
SOA and ESBs to the rescue 
In the Microsoft world, when discussing a 
framework that implements Service Oriented 
Architecture (SOA), one may think of the Windows 
Communication Foundation (WCF) web services.
Benefits for NSB 
 Separate business logic between services. 
 High availability of services. 
 Highly configurable. 
 Message durability in guaranteed delivery. 
 Viewing and monitoring messages and services give an 
end-to-end viewpoint. 
 Retries for sending of messages. 
 Message workflows in the form of Sagas. 
 Heartbeats to give real-time status. 
 Easy encryption of messages and data. 
 NSB Hosting and installation tools.
Some Basics 
October 10, 2014 
By Rich Helton
The Message 
NSB is built to send messages on a queue using a variety 
message queues and techniques, along to various 
configurations for almost any type of Service. First we start 
with messages. 
 IMessage – is a basic message interface. 
 IEvent – used mostly for publish-subscribe, and is a type 
of IMessage. 
 ICommand – used mostly for request-response, and is a 
type of IMessage.
Some simple Message code
The Bus 
NSB is built on configuring its ESB bus called IBus, and I can 
be configured for multiple queue and persistence, 
endpoint, services and message scenarios. A very basic 
configure.
The Message handler 
NSB sends messages through the Send() or Publish() 
methods, but it needs a message handler to be listening 
on on the message queue to process the message. A 
message handler will listen on an endpoint looking for a 
particular message. 
The endpoints and message that it is listening for is 
defined in the App.config, and in the message handler 
function.
A simple Message handler
Additional Tools 
October 10, 2014 
By Rich Helton
Additional Tools for NSB 
 Service Matrix is a graphical interface extension in Visual 
Studio for rapid development. 
 Service Pulse is a production monitoring tool for 
heartbeats and messages. 
 Service Insight provides deep insight into endpoints, 
messages and services.
ServiceMatrix 
Service Matrix is a graphical interface extension in Visual 
Studio for rapid development. It will generate code from 
models.
ServiceMatrix 
Soultion Builder
ServicePulse 
Getting heartbeats and custom messages for Production. 
It is installed as a service that is connected through a URL 
http://localhost:9090/#/dashboard
ServiceInsight 
ServiceInsight provides a deep insight into messages, 
endpoints and services as they run, to include a graphical 
representation.
ServiceInsight Messages 
ServiceInsight provides detailed message views.
Message Models 
Sept 25, 2014 
By Rich Helton
Message Features 
 NSB supports many message models such as request-response 
and publish-subscribe. 
 Messages do not have to be only messages for the NSB 
Bus, but NSB integrates into databases and web services 
as well for third party integration. 
 NSB can also be used to integrate into File I/O , as well as 
the Secure File tranfer Protocol.
Publish-subscribe 
 NSB supports publish-subscribe, where a publisher puts 
the message on a queue where multiple subscribers may 
read it off the queue.
Request-response 
 NSB supports request-response, where a requester sends 
a message that the replier receives and responds with a 
different message.
Saga services 
NSB supports sagas, the ability to save message state and 
respond back to the originator with changes. This is saving 
message state.
Timeout Message 
NSB supports timeout messages, the ability to set a timer 
in seconds, minutes, etc., or time of day to send a special 
message that a timeout has occurred, and to process the 
action, such as delete a message, start a job, and more. 
Here, we schedule a task every minute. 
public void Handle(ScheduleATask message) 
{ 
Console.WriteLine("Scheduling a task to be executed every 
1 minute"); 
Schedule.Every(TimeSpan.FromMinutes(1)).Action(() => bus. 
SendLocal(new ScheduledTaskExecuted())); 
}
Message Mutators 
NSB supports message mutators, the ability to mutate, or 
change, messages during runtime as the message is 
transmitted through different endpoints. This is valuable 
tool for adding information, such as debugging, or 
informational, information as it is running.
Message Encryption 
NSB supports message encryption, the ability to encrypt 
pieces or the whole of messages and data. The default 
encryption used by NSB is AES.
Scaleout 
NSB supports scaleout messaging for clustering, this is the 
ability to have multiple worker services, that are clones of 
the same codebase, with a single sender, to offload the 
performance to multiple machines.
Performance Monitoring 
NSB supports performance counters integration into the 
Windows Performance Monitor to get statistics on 
endpoints, messages and services.
Gateways 
NSB supports gateways, which is the ability to send 
messages through an HTTP/HTTPS tunneling, in scenarios 
where HTTPS is needed for security and messages need to 
pass through these protocols to meet firewall 
requirements.
Databus 
NSB supports databus, which is the ability to attach a file 
to a link, or attachment, with the message, because the 
file is too large to be enclosed in the message itself.
Sagas, What are they 
good for? 
October 10, 2014 
By Rich Helton
Saga Features 
 Sagas can save state of messages into a data store. 
 Sagas can route messages based on message state. 
 Sagas are event driven to be started by messages. 
 Sagas contain timers to execute events on messages, the 
timer can be a periodic time such as every hour, or to 
execute at a certain date and time.
Sagas intercept and send 
messages 
Sagas are started by messages, they save data, and send 
messages. As they intercept messages, they can read and 
save state based on the message ID to add changes to the 
message, creating workflow.
Saga visual
Saga saves data 
Sagas will save data from a message in the form of the 
IContainSaga interface.
Saga maps data 
Sagas will map the data, depending on the IBus 
configuration, from/to the message to/from the Saga Data 
object.
Saga handle messages 
Sagas are started by at least one message and handler 
messages.
Saga data from messages 
Sagas can save data, the Data object, associated with a 
message key to get details on the end-to-end workflow of 
the message
Saga data from messages 
Sagas can retrieve data associated with a message key to 
get details on the end-to-end workflow of the message
ConfigureHowToFindSags() 
Sagas need to know how to lookup messages, the key 
association, usually from an ID in the message, the 
ConfigureHowToFindSaga() performs this function.
Timeouts 
Sagas can handle timeouts 
Set a timer 
 Catch a timer message
Semi-conclusions 
Sagas are very robust and require a class of slides unto 
themselves. 
More on them later.
Persistence Patterns 
October 10, 2014 
By Rich Helton
Persistence Features 
 NSB supports many methods to queue and persists 
messages. 
 NSB can save subscription information for publish-subscribe 
in various models. 
 NSB can save Saga data information into various models. 
 NSB takes care of the mapping of the data objects.
Available Persistent models
Persistence interfaces 
 In-Memory – items that are persisted in the the memory 
of the service itself. 
 RavenDB – the default for many items like subscriptions, 
items are persisted in a local Raven database. 
 MSMQ – the default for messages, items are persisted in 
the Microsoft Message Queuing. 
 NHibernate – a .NET Hibernate framework to map 
objects to relational databases, to include SQL Server, 
MySQL, and many others.
What is persisted? 
 Timeouts – items that keep track of timeouts. Default is 
RavenDB. 
 Subscriptions – the information to keep track of the 
subscriber information in publish-subscribe. Default is 
RavenDB. 
 Sagas – the information stored for Saga data from 
messages. Default is RavenDB. 
 Gateway – the information to keep track of gateway 
messaging. Default is RavenDB. 
 Distributor – the messages that is sent to different 
workers. Default is MSMQ.
Messages 
Messages can also be persisted in different types of 
queues. 
 By default, NSB sends messages in MSMQ. 
 However, by using NHibernate, SQL queuing could just as 
easily be used to send messages.
Semi-conclusions 
NSB persistent patterns are very robust and require a class 
of slides unto themselves. 
More on them later.
WCF Basics 
October 10, 2014 
By Rich Helton
Feature of WCF 
The Windows Communication Foundation (WCF) is a 
Microsoft framework for establishing communications 
between endpoints, usually between web services. 
 Communication can happen over HTTP, TCP, IPC, 
or even MSMQ.
The ABCs of WCF 
WCF needs specific information to establish a connection 
to exchange data: 
Address – the URL address to establish a connection. 
Binding – which defines the types of services that provide 
connections, include security and encoding settings. 
Contracts – defines the operational, the API functions, and 
data that will be available from the server to the clients.
Contracts 
There are three main types of contracts: 
Service – defines the overall web service starting point. 
Operational – defines the available methods from the 
service. 
Data – defines the available data, through serialization, 
that is available from the endpoints, usually in the method 
types.
Operational Contracts 
The [OperationContract] defines the available methods 
from the service.
Data Contracts 
The [DataContract] defines the available data from the 
service.
The address 
The address, or available URL, is defined for the server in 
its App.config or Web.config.
The binding type 
The binding type is defined for the server in its App.config 
or Web.config. 
We are using the basic http binding and mex http binding 
as well to expose the endpoint to the client.
Many binding types 
There many binding types in WCF as there are many 
different transport and message types. 
A list can be found at 
http://msdn.microsoft.com/en-us/library/ms730879(v=vs.110).
SVC Config Editor 
We can graphically configure the App.config, or 
Web.config if IIS app, using the service configuration 
editor. 
Opening it in Visual Studio,
SVC Config overview 
We can see all the items to graphically configure
Seeing the contract 
The client will need import the contracts in the 
form of a proxy to communicate to the server. 
One of the forms of importing web service 
interfaces is the Web Service Definition Language 
(WSDL).
The WSDL is online 
In most cases the WSDL is online, as it defines the 
interfaces needed for the clients.
Viewing the WSDL 
We can see that the WSDL has many of the ABC web 
service components to connect to the web service server.
Adding the Service Reference 
We can add the Service Reference to the client to use the 
interfaces to communicate to the server.
The Service shows us sample 
client code
Implementing the client code
Adding Tracing 
The WCF Services, be it client or server, can have trace 
listeners to be added to the application as it runs. 
Microsoft provides a Service Trace Viewer to view 
these messages, as the interaction can contain 
WCF specific pieces. 
See http://msdn.microsoft.com/en-us/ 
library/ms732023(v=vs.110).aspx
Configure Tracing 
We can configure the tracing through the service 
configuration editor, to store in the App.config.
Viewing Tracing 
This will allow us to get information on endpoints, 
such as the messages.
Hosting WCF 
The WCF Server listens for incoming requests from the 
WCF client. Therefore, it should be available when a client 
needs to connect. 
The WCF Service can be running as a Windows Service. 
In an IIS application. 
Self-Hosted as a .NET application, usually with a 
command window. 
Or as a Windows Process Activation Service 
(WAS).
WCF Integration 
Sept 25, 2014 
By Rich Helton
NSB support of WCF 
NSB supports WCF integration. 
The benefits of using NSB with WCF are: 
NSB simplifies the coding of contracts of WCF, as 
well as hosting. 
This saves on development time. 
A web service endpoint can be handled as any 
other NSB endpoint. 
This allows all the other benefits of NSB in WCF, 
such as message encryption and retries.
NSB-WCF messages 
Messages in NSB are defined with the IMessage 
interface. This can be done instead of a data 
contract in WCF. 
public class PaymentMessage : IMessage 
{ 
public Guid EventId { get; set; } 
public PaymentReq paymentReq { get; set; } 
}
NSB-WCF operations 
Instead of using operations in WCF, NSB uses 
message handlers to receive a defined message 
and process it, and in many cases send back a 
message response.
NSB-WCF-Saga 
Becuase NSB supports Saga workflows, retries, 
timeouts, tools for production, rapid development, 
and managing services, these tools can be applied 
to WCF web services, and we can use NSB to retry 
a web service, error report on it, manage the 
service, and use Saga workflow to manage the 
business logic in the WCF web service.
NSB Hosting 
October 10, 2014 
By Rich Helton
NSB hosting features 
NServiceBus.Host.exe is an executable to install, and 
uninstall, DLL's using NSB as Windows services. 
This includes features to add additional configurations 
during runtime, to include endpoints. 
The NServiceBus.Host framework and executable will 
streamline the installation process by creating endpoints. 
It will handle the Windows service installation and provide 
NSB management features as well.
Host and Visual Studio 
NServiceBus.Host.exe is an executable that can be used as 
a reference in Visual Studio. 
This is so the service can be DLL, it can generate endpoint 
template code, and run the DLL in Visual Studio.
Debug 
In the Debug properties of the project, we can see 
NServiceBus.Host.exe running the DLL that is created.
EndpointConfig 
NServiceBus.Host.exe will create a default 
EndpointConfig.cs when it is added to the project's 
references.
The Host has several 
deployments 
NServiceBus.Host.exe has several configurations to run 
worker services, installations, creating endpoints, and 
much more.
Conclusion 
NSB brings a lot of features to the table with a small price.

More Related Content

What's hot

New Features Of ASP.Net 4 0
New Features Of ASP.Net 4 0New Features Of ASP.Net 4 0
New Features Of ASP.Net 4 0Dima Maleev
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?NexSoftsys
 
Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011grandyho
 
The complete ASP.NET (IIS) Tutorial with code example in power point slide show
The complete ASP.NET (IIS) Tutorial with code example in power point slide showThe complete ASP.NET (IIS) Tutorial with code example in power point slide show
The complete ASP.NET (IIS) Tutorial with code example in power point slide showSubhas Malik
 
Building & managing wa app wely
Building & managing wa app   welyBuilding & managing wa app   wely
Building & managing wa app welySpiffy
 
Concepts of Asp.Net
Concepts of Asp.NetConcepts of Asp.Net
Concepts of Asp.Netvidyamittal
 
Flex Introduction
Flex Introduction Flex Introduction
Flex Introduction senthil0809
 
BizSpark Startup Night Windows Azure March 29, 2011
BizSpark Startup Night Windows Azure March 29, 2011BizSpark Startup Night Windows Azure March 29, 2011
BizSpark Startup Night Windows Azure March 29, 2011Spiffy
 
Mule ESB
Mule ESBMule ESB
Mule ESBniravn
 
Why use .net by naveen kumar veligeti
Why use .net by naveen kumar veligetiWhy use .net by naveen kumar veligeti
Why use .net by naveen kumar veligetiNaveen Kumar Veligeti
 
New Features of ASP.NET 4.0
New Features of ASP.NET 4.0New Features of ASP.NET 4.0
New Features of ASP.NET 4.0Buu Nguyen
 
Windows Azure AppFabric
Windows Azure AppFabricWindows Azure AppFabric
Windows Azure AppFabricDavid Chou
 
Building web applications with Java & Spring
Building web applications with Java & SpringBuilding web applications with Java & Spring
Building web applications with Java & SpringDavid Kiss
 
Mulesoft Basics and Connector Details
Mulesoft Basics and Connector DetailsMulesoft Basics and Connector Details
Mulesoft Basics and Connector DetailsArun Yaligar
 

What's hot (20)

New Features Of ASP.Net 4 0
New Features Of ASP.Net 4 0New Features Of ASP.Net 4 0
New Features Of ASP.Net 4 0
 
Day2
Day2Day2
Day2
 
Anypoint data gateway
Anypoint data gatewayAnypoint data gateway
Anypoint data gateway
 
How Spring Framework Really Works?
How Spring Framework Really Works?How Spring Framework Really Works?
How Spring Framework Really Works?
 
Day7
Day7Day7
Day7
 
Mule connectors
Mule  connectorsMule  connectors
Mule connectors
 
Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011Apache Etch Introduction @ FOSDEM 2011
Apache Etch Introduction @ FOSDEM 2011
 
The complete ASP.NET (IIS) Tutorial with code example in power point slide show
The complete ASP.NET (IIS) Tutorial with code example in power point slide showThe complete ASP.NET (IIS) Tutorial with code example in power point slide show
The complete ASP.NET (IIS) Tutorial with code example in power point slide show
 
Building & managing wa app wely
Building & managing wa app   welyBuilding & managing wa app   wely
Building & managing wa app wely
 
Concepts of Asp.Net
Concepts of Asp.NetConcepts of Asp.Net
Concepts of Asp.Net
 
Flex Introduction
Flex Introduction Flex Introduction
Flex Introduction
 
BizSpark Startup Night Windows Azure March 29, 2011
BizSpark Startup Night Windows Azure March 29, 2011BizSpark Startup Night Windows Azure March 29, 2011
BizSpark Startup Night Windows Azure March 29, 2011
 
Mule ESB
Mule ESBMule ESB
Mule ESB
 
Why use .net by naveen kumar veligeti
Why use .net by naveen kumar veligetiWhy use .net by naveen kumar veligeti
Why use .net by naveen kumar veligeti
 
Azure Umbraco workshop
Azure Umbraco workshopAzure Umbraco workshop
Azure Umbraco workshop
 
New Features of ASP.NET 4.0
New Features of ASP.NET 4.0New Features of ASP.NET 4.0
New Features of ASP.NET 4.0
 
Windows Azure AppFabric
Windows Azure AppFabricWindows Azure AppFabric
Windows Azure AppFabric
 
Building web applications with Java & Spring
Building web applications with Java & SpringBuilding web applications with Java & Spring
Building web applications with Java & Spring
 
Mule testing
Mule testingMule testing
Mule testing
 
Mulesoft Basics and Connector Details
Mulesoft Basics and Connector DetailsMulesoft Basics and Connector Details
Mulesoft Basics and Connector Details
 

Similar to NServicebus WCF Integration 101

SQL Server Service Broker – A Competent Architecture by Microsoft
SQL Server Service Broker – A Competent Architecture by MicrosoftSQL Server Service Broker – A Competent Architecture by Microsoft
SQL Server Service Broker – A Competent Architecture by Microsoftsara stanford
 
Enterprise Service Bus Features and Advantages.docx
Enterprise Service Bus Features and Advantages.docxEnterprise Service Bus Features and Advantages.docx
Enterprise Service Bus Features and Advantages.docxcirek63365
 
Enterprise Integration with WSO2 ESB
Enterprise Integration with WSO2 ESBEnterprise Integration with WSO2 ESB
Enterprise Integration with WSO2 ESBWSO2
 
NServiceBus and SOA 2.0 Resources
NServiceBus and SOA 2.0 ResourcesNServiceBus and SOA 2.0 Resources
NServiceBus and SOA 2.0 ResourcesDanny Fafach
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Jason Townsend, MBA
 
Windows Azure Queues and Windows Azure Service Bus Queues
Windows Azure Queues and Windows Azure Service Bus QueuesWindows Azure Queues and Windows Azure Service Bus Queues
Windows Azure Queues and Windows Azure Service Bus QueuesJuan Pablo
 
Windows azure service bus reference
Windows azure service bus referenceWindows azure service bus reference
Windows azure service bus referenceJose Vergara Veas
 
Maximize Messaging and Performance and Lowering Infrastructure Footprint
Maximize Messaging and Performance and Lowering Infrastructure FootprintMaximize Messaging and Performance and Lowering Infrastructure Footprint
Maximize Messaging and Performance and Lowering Infrastructure FootprintWSO2
 
Soa interview questions
Soa interview questionsSoa interview questions
Soa interview questionsxavier john
 
The Carbon Story
The Carbon StoryThe Carbon Story
The Carbon StoryWSO2
 
Soa interview questions (autosaved)
Soa interview questions (autosaved)Soa interview questions (autosaved)
Soa interview questions (autosaved)xavier john
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKXMike Willbanks
 

Similar to NServicebus WCF Integration 101 (20)

ISUG SSB Lior King
ISUG SSB Lior KingISUG SSB Lior King
ISUG SSB Lior King
 
Wso2 tutorial
Wso2 tutorialWso2 tutorial
Wso2 tutorial
 
SQL Server Service Broker – A Competent Architecture by Microsoft
SQL Server Service Broker – A Competent Architecture by MicrosoftSQL Server Service Broker – A Competent Architecture by Microsoft
SQL Server Service Broker – A Competent Architecture by Microsoft
 
Enterprise Service Bus Features and Advantages.docx
Enterprise Service Bus Features and Advantages.docxEnterprise Service Bus Features and Advantages.docx
Enterprise Service Bus Features and Advantages.docx
 
Enterprise Integration with WSO2 ESB
Enterprise Integration with WSO2 ESBEnterprise Integration with WSO2 ESB
Enterprise Integration with WSO2 ESB
 
NServiceBus and SOA 2.0 Resources
NServiceBus and SOA 2.0 ResourcesNServiceBus and SOA 2.0 Resources
NServiceBus and SOA 2.0 Resources
 
Intro to Azure Service Bus
Intro to Azure Service BusIntro to Azure Service Bus
Intro to Azure Service Bus
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003
 
Windows Azure Queues and Windows Azure Service Bus Queues
Windows Azure Queues and Windows Azure Service Bus QueuesWindows Azure Queues and Windows Azure Service Bus Queues
Windows Azure Queues and Windows Azure Service Bus Queues
 
A secure middleware architecture for web services
A secure middleware architecture for web servicesA secure middleware architecture for web services
A secure middleware architecture for web services
 
Windows azure service bus reference
Windows azure service bus referenceWindows azure service bus reference
Windows azure service bus reference
 
Maximize Messaging and Performance and Lowering Infrastructure Footprint
Maximize Messaging and Performance and Lowering Infrastructure FootprintMaximize Messaging and Performance and Lowering Infrastructure Footprint
Maximize Messaging and Performance and Lowering Infrastructure Footprint
 
Soa interview questions
Soa interview questionsSoa interview questions
Soa interview questions
 
The Carbon Story
The Carbon StoryThe Carbon Story
The Carbon Story
 
Soa interview questions (autosaved)
Soa interview questions (autosaved)Soa interview questions (autosaved)
Soa interview questions (autosaved)
 
Riding with camel
Riding with camelRiding with camel
Riding with camel
 
The Art of Message Queues - TEKX
The Art of Message Queues - TEKXThe Art of Message Queues - TEKX
The Art of Message Queues - TEKX
 
NServiceBus
NServiceBusNServiceBus
NServiceBus
 
Choosing The Right ESB
Choosing The Right ESBChoosing The Right ESB
Choosing The Right ESB
 
Amazon Web Service.pdf
Amazon Web Service.pdfAmazon Web Service.pdf
Amazon Web Service.pdf
 

More from Rich Helton

Java for Mainframers
Java for MainframersJava for Mainframers
Java for MainframersRich Helton
 
I pad uicatalog_lesson02
I pad uicatalog_lesson02I pad uicatalog_lesson02
I pad uicatalog_lesson02Rich Helton
 
Mongo db rev001.
Mongo db rev001.Mongo db rev001.
Mongo db rev001.Rich Helton
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101Rich Helton
 
Entity frameworks101
Entity frameworks101Entity frameworks101
Entity frameworks101Rich Helton
 
Salesforce Intro
Salesforce IntroSalesforce Intro
Salesforce IntroRich Helton
 
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
LEARNING	 iPAD STORYBOARDS IN OBJ-­‐C LESSON 1LEARNING	 iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1Rich Helton
 
Learning C# iPad Programming
Learning C# iPad ProgrammingLearning C# iPad Programming
Learning C# iPad ProgrammingRich Helton
 
First Steps in Android
First Steps in AndroidFirst Steps in Android
First Steps in AndroidRich Helton
 
Python For Droid
Python For DroidPython For Droid
Python For DroidRich Helton
 
Spring Roo Rev005
Spring Roo Rev005Spring Roo Rev005
Spring Roo Rev005Rich Helton
 
Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Rich Helton
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalRich Helton
 
Sql Injection and Entity Frameworks
Sql Injection and Entity FrameworksSql Injection and Entity Frameworks
Sql Injection and Entity FrameworksRich Helton
 
C# Security Testing and Debugging
C# Security Testing and DebuggingC# Security Testing and Debugging
C# Security Testing and DebuggingRich Helton
 
Web Application Firewall intro
Web Application Firewall introWeb Application Firewall intro
Web Application Firewall introRich Helton
 
Java Web Security Class
Java Web Security ClassJava Web Security Class
Java Web Security ClassRich Helton
 

More from Rich Helton (20)

Java for Mainframers
Java for MainframersJava for Mainframers
Java for Mainframers
 
I pad uicatalog_lesson02
I pad uicatalog_lesson02I pad uicatalog_lesson02
I pad uicatalog_lesson02
 
Mongo db rev001.
Mongo db rev001.Mongo db rev001.
Mongo db rev001.
 
AspMVC4 start101
AspMVC4 start101AspMVC4 start101
AspMVC4 start101
 
Entity frameworks101
Entity frameworks101Entity frameworks101
Entity frameworks101
 
Salesforce Intro
Salesforce IntroSalesforce Intro
Salesforce Intro
 
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
LEARNING	 iPAD STORYBOARDS IN OBJ-­‐C LESSON 1LEARNING	 iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
LEARNING  iPAD STORYBOARDS IN OBJ-­‐C LESSON 1
 
Learning C# iPad Programming
Learning C# iPad ProgrammingLearning C# iPad Programming
Learning C# iPad Programming
 
First Steps in Android
First Steps in AndroidFirst Steps in Android
First Steps in Android
 
Python For Droid
Python For DroidPython For Droid
Python For Droid
 
Spring Roo Rev005
Spring Roo Rev005Spring Roo Rev005
Spring Roo Rev005
 
Python Final
Python FinalPython Final
Python Final
 
Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4Overview of CSharp MVC3 and EF4
Overview of CSharp MVC3 and EF4
 
Adobe Flex4
Adobe Flex4 Adobe Flex4
Adobe Flex4
 
C#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 FinalC#Web Sec Oct27 2010 Final
C#Web Sec Oct27 2010 Final
 
Jira Rev002
Jira Rev002Jira Rev002
Jira Rev002
 
Sql Injection and Entity Frameworks
Sql Injection and Entity FrameworksSql Injection and Entity Frameworks
Sql Injection and Entity Frameworks
 
C# Security Testing and Debugging
C# Security Testing and DebuggingC# Security Testing and Debugging
C# Security Testing and Debugging
 
Web Application Firewall intro
Web Application Firewall introWeb Application Firewall intro
Web Application Firewall intro
 
Java Web Security Class
Java Web Security ClassJava Web Security Class
Java Web Security Class
 

Recently uploaded

%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durbanmasabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationShrmpro
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 

Recently uploaded (20)

%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
SHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions PresentationSHRMPro HRMS Software Solutions Presentation
SHRMPro HRMS Software Solutions Presentation
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 

NServicebus WCF Integration 101

  • 1. NServiceBus and WCF Integration 101 October 10, 2014 By Rich Helton
  • 2. Why NServiceBus?  NServiceBus (NSB) is the most popular ESB for the C# platform in existence.  It is decentralized and has many tools to assist in deployment.  Many people may wonder the need to use an ESB? It is to manage services for any applications not performing in the website.
  • 3. Source code My test source code can be found at https://github.com/richhelton Particular samples and souce code can be found at https://github.com/Particular
  • 4. For those that don't use ESBs.... You may see many websites that say “Don't refresh this page” for instance as they are website only centric that may not consider an ESB.  You may also talk to some of their staff to know that they do not acknowledge that server and network errors can occur.  For those who want to monitor their services, transactions, messages, and give your website the ability to refresh a page after you enter a credit card, we have NSB.
  • 5. What is a Service-Oriented Architecture SOA is a combination of design patterns, usually implemented through frameworks. SOA combines distinct services that are communicated through messages to cooperate as a single end-to-end business system. A service could be considered a Windows service, or a distinct unit of work, such as a mainframe job.
  • 7. More SOA Advantages By using services, we may start/stop services based on performance.  We may get running totals on the number of successful and error messages.
  • 8. What is a Enterprise Service Bus (ESB)? ESB is a software architecture design model in which a common bus is shared across a framework to allow common agreed upon communication between different endpoints or services.
  • 10. Software Quality Software Quality are cross-cutting features of the software, that normally defines the technical requirements of the software itself. These qualities are usually security, re-use, maintainability, reliability, efficiency, and other characteristics that make one want to use the framework. Notice that NSB match these qualities one-to-one.
  • 11. SOA and ESBs to the rescue In the Microsoft world, when discussing a framework that implements Service Oriented Architecture (SOA), one may think of the Windows Communication Foundation (WCF) web services.
  • 12. SOA and ESBs to the rescue In the Microsoft world, when discussing a framework that implements Service Oriented Architecture (SOA), one may think of the Windows Communication Foundation (WCF) web services.
  • 13. Benefits for NSB  Separate business logic between services.  High availability of services.  Highly configurable.  Message durability in guaranteed delivery.  Viewing and monitoring messages and services give an end-to-end viewpoint.  Retries for sending of messages.  Message workflows in the form of Sagas.  Heartbeats to give real-time status.  Easy encryption of messages and data.  NSB Hosting and installation tools.
  • 14. Some Basics October 10, 2014 By Rich Helton
  • 15. The Message NSB is built to send messages on a queue using a variety message queues and techniques, along to various configurations for almost any type of Service. First we start with messages.  IMessage – is a basic message interface.  IEvent – used mostly for publish-subscribe, and is a type of IMessage.  ICommand – used mostly for request-response, and is a type of IMessage.
  • 17. The Bus NSB is built on configuring its ESB bus called IBus, and I can be configured for multiple queue and persistence, endpoint, services and message scenarios. A very basic configure.
  • 18. The Message handler NSB sends messages through the Send() or Publish() methods, but it needs a message handler to be listening on on the message queue to process the message. A message handler will listen on an endpoint looking for a particular message. The endpoints and message that it is listening for is defined in the App.config, and in the message handler function.
  • 19. A simple Message handler
  • 20. Additional Tools October 10, 2014 By Rich Helton
  • 21. Additional Tools for NSB  Service Matrix is a graphical interface extension in Visual Studio for rapid development.  Service Pulse is a production monitoring tool for heartbeats and messages.  Service Insight provides deep insight into endpoints, messages and services.
  • 22. ServiceMatrix Service Matrix is a graphical interface extension in Visual Studio for rapid development. It will generate code from models.
  • 24. ServicePulse Getting heartbeats and custom messages for Production. It is installed as a service that is connected through a URL http://localhost:9090/#/dashboard
  • 25. ServiceInsight ServiceInsight provides a deep insight into messages, endpoints and services as they run, to include a graphical representation.
  • 26. ServiceInsight Messages ServiceInsight provides detailed message views.
  • 27. Message Models Sept 25, 2014 By Rich Helton
  • 28. Message Features  NSB supports many message models such as request-response and publish-subscribe.  Messages do not have to be only messages for the NSB Bus, but NSB integrates into databases and web services as well for third party integration.  NSB can also be used to integrate into File I/O , as well as the Secure File tranfer Protocol.
  • 29. Publish-subscribe  NSB supports publish-subscribe, where a publisher puts the message on a queue where multiple subscribers may read it off the queue.
  • 30. Request-response  NSB supports request-response, where a requester sends a message that the replier receives and responds with a different message.
  • 31. Saga services NSB supports sagas, the ability to save message state and respond back to the originator with changes. This is saving message state.
  • 32. Timeout Message NSB supports timeout messages, the ability to set a timer in seconds, minutes, etc., or time of day to send a special message that a timeout has occurred, and to process the action, such as delete a message, start a job, and more. Here, we schedule a task every minute. public void Handle(ScheduleATask message) { Console.WriteLine("Scheduling a task to be executed every 1 minute"); Schedule.Every(TimeSpan.FromMinutes(1)).Action(() => bus. SendLocal(new ScheduledTaskExecuted())); }
  • 33. Message Mutators NSB supports message mutators, the ability to mutate, or change, messages during runtime as the message is transmitted through different endpoints. This is valuable tool for adding information, such as debugging, or informational, information as it is running.
  • 34. Message Encryption NSB supports message encryption, the ability to encrypt pieces or the whole of messages and data. The default encryption used by NSB is AES.
  • 35. Scaleout NSB supports scaleout messaging for clustering, this is the ability to have multiple worker services, that are clones of the same codebase, with a single sender, to offload the performance to multiple machines.
  • 36. Performance Monitoring NSB supports performance counters integration into the Windows Performance Monitor to get statistics on endpoints, messages and services.
  • 37. Gateways NSB supports gateways, which is the ability to send messages through an HTTP/HTTPS tunneling, in scenarios where HTTPS is needed for security and messages need to pass through these protocols to meet firewall requirements.
  • 38. Databus NSB supports databus, which is the ability to attach a file to a link, or attachment, with the message, because the file is too large to be enclosed in the message itself.
  • 39. Sagas, What are they good for? October 10, 2014 By Rich Helton
  • 40. Saga Features  Sagas can save state of messages into a data store.  Sagas can route messages based on message state.  Sagas are event driven to be started by messages.  Sagas contain timers to execute events on messages, the timer can be a periodic time such as every hour, or to execute at a certain date and time.
  • 41. Sagas intercept and send messages Sagas are started by messages, they save data, and send messages. As they intercept messages, they can read and save state based on the message ID to add changes to the message, creating workflow.
  • 43. Saga saves data Sagas will save data from a message in the form of the IContainSaga interface.
  • 44. Saga maps data Sagas will map the data, depending on the IBus configuration, from/to the message to/from the Saga Data object.
  • 45. Saga handle messages Sagas are started by at least one message and handler messages.
  • 46. Saga data from messages Sagas can save data, the Data object, associated with a message key to get details on the end-to-end workflow of the message
  • 47. Saga data from messages Sagas can retrieve data associated with a message key to get details on the end-to-end workflow of the message
  • 48. ConfigureHowToFindSags() Sagas need to know how to lookup messages, the key association, usually from an ID in the message, the ConfigureHowToFindSaga() performs this function.
  • 49. Timeouts Sagas can handle timeouts Set a timer  Catch a timer message
  • 50. Semi-conclusions Sagas are very robust and require a class of slides unto themselves. More on them later.
  • 51. Persistence Patterns October 10, 2014 By Rich Helton
  • 52. Persistence Features  NSB supports many methods to queue and persists messages.  NSB can save subscription information for publish-subscribe in various models.  NSB can save Saga data information into various models.  NSB takes care of the mapping of the data objects.
  • 54. Persistence interfaces  In-Memory – items that are persisted in the the memory of the service itself.  RavenDB – the default for many items like subscriptions, items are persisted in a local Raven database.  MSMQ – the default for messages, items are persisted in the Microsoft Message Queuing.  NHibernate – a .NET Hibernate framework to map objects to relational databases, to include SQL Server, MySQL, and many others.
  • 55. What is persisted?  Timeouts – items that keep track of timeouts. Default is RavenDB.  Subscriptions – the information to keep track of the subscriber information in publish-subscribe. Default is RavenDB.  Sagas – the information stored for Saga data from messages. Default is RavenDB.  Gateway – the information to keep track of gateway messaging. Default is RavenDB.  Distributor – the messages that is sent to different workers. Default is MSMQ.
  • 56. Messages Messages can also be persisted in different types of queues.  By default, NSB sends messages in MSMQ.  However, by using NHibernate, SQL queuing could just as easily be used to send messages.
  • 57. Semi-conclusions NSB persistent patterns are very robust and require a class of slides unto themselves. More on them later.
  • 58. WCF Basics October 10, 2014 By Rich Helton
  • 59. Feature of WCF The Windows Communication Foundation (WCF) is a Microsoft framework for establishing communications between endpoints, usually between web services.  Communication can happen over HTTP, TCP, IPC, or even MSMQ.
  • 60. The ABCs of WCF WCF needs specific information to establish a connection to exchange data: Address – the URL address to establish a connection. Binding – which defines the types of services that provide connections, include security and encoding settings. Contracts – defines the operational, the API functions, and data that will be available from the server to the clients.
  • 61. Contracts There are three main types of contracts: Service – defines the overall web service starting point. Operational – defines the available methods from the service. Data – defines the available data, through serialization, that is available from the endpoints, usually in the method types.
  • 62. Operational Contracts The [OperationContract] defines the available methods from the service.
  • 63. Data Contracts The [DataContract] defines the available data from the service.
  • 64. The address The address, or available URL, is defined for the server in its App.config or Web.config.
  • 65. The binding type The binding type is defined for the server in its App.config or Web.config. We are using the basic http binding and mex http binding as well to expose the endpoint to the client.
  • 66. Many binding types There many binding types in WCF as there are many different transport and message types. A list can be found at http://msdn.microsoft.com/en-us/library/ms730879(v=vs.110).
  • 67. SVC Config Editor We can graphically configure the App.config, or Web.config if IIS app, using the service configuration editor. Opening it in Visual Studio,
  • 68. SVC Config overview We can see all the items to graphically configure
  • 69. Seeing the contract The client will need import the contracts in the form of a proxy to communicate to the server. One of the forms of importing web service interfaces is the Web Service Definition Language (WSDL).
  • 70. The WSDL is online In most cases the WSDL is online, as it defines the interfaces needed for the clients.
  • 71. Viewing the WSDL We can see that the WSDL has many of the ABC web service components to connect to the web service server.
  • 72. Adding the Service Reference We can add the Service Reference to the client to use the interfaces to communicate to the server.
  • 73. The Service shows us sample client code
  • 75. Adding Tracing The WCF Services, be it client or server, can have trace listeners to be added to the application as it runs. Microsoft provides a Service Trace Viewer to view these messages, as the interaction can contain WCF specific pieces. See http://msdn.microsoft.com/en-us/ library/ms732023(v=vs.110).aspx
  • 76. Configure Tracing We can configure the tracing through the service configuration editor, to store in the App.config.
  • 77. Viewing Tracing This will allow us to get information on endpoints, such as the messages.
  • 78. Hosting WCF The WCF Server listens for incoming requests from the WCF client. Therefore, it should be available when a client needs to connect. The WCF Service can be running as a Windows Service. In an IIS application. Self-Hosted as a .NET application, usually with a command window. Or as a Windows Process Activation Service (WAS).
  • 79. WCF Integration Sept 25, 2014 By Rich Helton
  • 80. NSB support of WCF NSB supports WCF integration. The benefits of using NSB with WCF are: NSB simplifies the coding of contracts of WCF, as well as hosting. This saves on development time. A web service endpoint can be handled as any other NSB endpoint. This allows all the other benefits of NSB in WCF, such as message encryption and retries.
  • 81. NSB-WCF messages Messages in NSB are defined with the IMessage interface. This can be done instead of a data contract in WCF. public class PaymentMessage : IMessage { public Guid EventId { get; set; } public PaymentReq paymentReq { get; set; } }
  • 82. NSB-WCF operations Instead of using operations in WCF, NSB uses message handlers to receive a defined message and process it, and in many cases send back a message response.
  • 83. NSB-WCF-Saga Becuase NSB supports Saga workflows, retries, timeouts, tools for production, rapid development, and managing services, these tools can be applied to WCF web services, and we can use NSB to retry a web service, error report on it, manage the service, and use Saga workflow to manage the business logic in the WCF web service.
  • 84. NSB Hosting October 10, 2014 By Rich Helton
  • 85. NSB hosting features NServiceBus.Host.exe is an executable to install, and uninstall, DLL's using NSB as Windows services. This includes features to add additional configurations during runtime, to include endpoints. The NServiceBus.Host framework and executable will streamline the installation process by creating endpoints. It will handle the Windows service installation and provide NSB management features as well.
  • 86. Host and Visual Studio NServiceBus.Host.exe is an executable that can be used as a reference in Visual Studio. This is so the service can be DLL, it can generate endpoint template code, and run the DLL in Visual Studio.
  • 87. Debug In the Debug properties of the project, we can see NServiceBus.Host.exe running the DLL that is created.
  • 88. EndpointConfig NServiceBus.Host.exe will create a default EndpointConfig.cs when it is added to the project's references.
  • 89. The Host has several deployments NServiceBus.Host.exe has several configurations to run worker services, installations, creating endpoints, and much more.
  • 90. Conclusion NSB brings a lot of features to the table with a small price.