More Related Content Similar to Module 14 Building Custom Adapters Connectors Similar to Module 14 Building Custom Adapters Connectors (20) Module 14 Building Custom Adapters Connectors2. © Copyright 2014, Neudesic. All rights reserved.
Building Custom Adapters / Connectors – Overview
Goals of this session
• Understand how to build custom adapters using the Adapter Framework
• Understand how to use custom adapters inside a Neuron ESB solution
3. © Copyright 2014, Neudesic. All rights reserved.
Building Custom Adapters / Connectors – Objectives
• Understand the Adapter Framework architecture
• Learn how to build adapters
• Learn how to integrate and deploy custom adapters
• Learn how to debug adapters using Visual Studio .NET
4. © Copyright 2014, Neudesic. All rights reserved.
Building Custom Adapters / Connectors – Lesson Plan
• Adapter Framework
• Creating custom metadata
• Building a custom adapter
• Integrating custom adapters into the Neuron Explorer
• Debugging adapters at both design-time and run-time
5. © Copyright 2014, Neudesic. All rights reserved.
Understanding the Adapter Framework Architecture
The Neuron ESB adapter framework is a Visual Studio project, that provides a
template for building adapters to be leveraged inside of the Neuron ESB Explorer
Solution:
• ESB-Name-Adapter
• Classes
• Adapter.cs
• Inherits from ESBAdapterBase
• Contains base method overrides
• Framework helper code
• CertificateConverter.cs
• Used by a sample property to show how to perform type conversion
• Sample demonstrates how to access design time Neuron ESB Configuration
• NameAdapter.cs
• The class you edit when creating a new adapter; contains methods and properties to support the
UI property grid and adapter functionality.
6. © Copyright 2014, Neudesic. All rights reserved.
Understanding the Adapter Framework Architecture:
Constants and Types
Two existing constants:
• MetadataPrefix
• Used within the Neuron ESB
Explorer to identify properties
specific to the adapter1
• Properties registered with this
prefix in the adapters
constructor will appear in the
Set Property process step
• AdapterName
• Defines the “user friendly”
name that will appear in the
Adapter Registration screen
7. © Copyright 2014, Neudesic. All rights reserved.
Understanding the Adapter Framework Architecture:
Properties
• Defined properties are
visible on the property grid
at design-time
• Properties can be set to
either be hidden or visible
based on the values of
other properties
• Type convertors can be
used for defined properties1
• Defined properties are
displayed in the Bindings
Dialog, but can be declared
as not binable, if desired
8. © Copyright 2014, Neudesic. All rights reserved.
Understanding the Adapter Framework Architecture:
Constructor
• Define modes your adapter
will support
• Subscriber
• Publisher
• RequestReply
• SolicitResponse
• Define the
ESBAdapterCapabilities
• AdapterName
• MetadataPrefix
• MetadataFieldInfo1
• Any properties registered in
the constructor will appear in
the Set Property process step
9. © Copyright 2014, Neudesic. All rights reserved.
Understanding the Adapter Framework Architecture:
Base Methods
These methods are called from
within base adapter class methods:
• ConnectAdapter
• Validation logic and initialization of
resources used by custom adapter
• DisconnectResources
• Clean up all resources used by custom
adapter
• SendToDataSource
• Called when adapter is in any subscriber
based mode (Subscribe, Solicit
Response etc..)
• ReceiveFromDataSource
• Called when adapter is in any publisher
based mode (Publish, RequestReply
etc..)
• InitializeRequestReplyListener
• Setup of the reply listener as well as
handling the retrieval of data, as well as
creating the ESB reply message
10. © Copyright 2014, Neudesic. All rights reserved.
Understanding the Adapter Framework Architecture:
Send Methods
• These methods are used in
the various subscribe based
modes (Subscriber, Query,
SolicitResponse etc)
• SendToDataSource
• One way send to a back
end system, protocol,
transport etc (Subscribe)
• QueryDataSource
• Used in a Query or
SolicitResponse mode to
query information from the
a back end system and
publish the resulting data
retrieval to the Bus
11. © Copyright 2014, Neudesic. All rights reserved.
Understanding the Adapter Framework Architecture:
Publish Methods
• These methods are used in
the various publisher based
modes (Publish,
RequestReply etc)
• PublishMessageFromSource
• Implement logic to reach
out to data source and
then publish the resulting
data to the Bus
12. © Copyright 2014, Neudesic. All rights reserved.
Creating Custom Metadata
• Custom Metadata can be
added to an ESBMessage
using the IncludeMetadata
property, which is
configured on the General
tab of an adapter endpoint
in the Neuron ESB Explorer
• Custom Metadata are
provided with every
message sent or received
from Neuron ESB
• Metadata is added to a
message using the
following syntax
• MessageProperties.Add(new
NameValuePair(“PropertyName",
PropertyValue));
13. © Copyright 2014, Neudesic. All rights reserved.
How to Integrate Custom Adapters with
the Neuron ESB Explorer
• Compile into .NET assembly
• Copy to Adapters folder:
C:Program
FilesNeudesicNeuron ESB
v3DEFAULTAdapters
• Ensure dependencies are
installed in Adapters folder
or Neuron install folder
• Register Adapter in Neuron
ESB Explorer
14. © Copyright 2014, Neudesic. All rights reserved.
How to Debug Adapters at Both Design Time
and Run Time
Design Time
• Attach debugger to neuronexplorer.exe from visual studio
• Supports debugging of the adapter as well as the property grid
Run time
• Attach the debugger to esbservice.exe in order to debug adapters or the adapter
business process step
• Attach the debugger to esbhost.exe in order to debug the adapter workflow activity
15. Purpose
Familiarize users with the Neuron ESB Adapter Framework
Objectives
Acquaint users with following aspects custom adapters
• How to build a custom adapter
• How to integrate and deploy custom adapters
Building Custom Adapters / Connectors: Demo
16. To acquaint users with building a custom adapter and registering it with
Neuron ESB, this lab will guide users through the following tasks:
• Use the Adapter Framework to build a custom adapter
• Copy the custom adapter DLL to Neuron’s Directories
• Register the custom adapter with Neuron ESB
Building Custom Adapters / Connectors – Lab
17. © Copyright 2014, Neudesic. All rights reserved.
Building Custom Adapters / Connectors – Review
• When would you build a custom adapter?
• What does Neuron ESB provide in order to facilitate the building of custom adapters?
• How would you make an adapter publish only?
• What Base Method is used when an adapter is in subscribe mode?
• What Base Method is used when an adapter is in publisher mode?
• How do you include Metadata in an adapter?
Editor's Notes The MetadataPrefix is the prefix used for properties in both the data.Context.SetProperty() and data.Context.GetProperty() methods. Type convertors are useful when you wish to populate a dropdown list in the properties grid
MetadataFieldInfo is a comma delimited string with the syntax <prefix>.<property name>:<description>