NetEventRelayBinding Class
TOC
Collapse the table of content
Expand the table of content

NetEventRelayBinding Class

 

Represents a binding that supports one-way event multicasting and allows any number of event publishers and event consumers to rendezvous at the same endpoint.

Namespace:   Microsoft.ServiceBus
Assembly:  Microsoft.ServiceBus (in Microsoft.ServiceBus.dll)

System.Object
  System.ServiceModel.Channels.Binding
    Microsoft.ServiceBus.NetOnewayRelayBinding
      Microsoft.ServiceBus.NetEventRelayBinding

public class NetEventRelayBinding : NetOnewayRelayBinding, IBindingRuntimePreferences

NameDescription
System_CAPS_pubmethodNetEventRelayBinding()

Initializes a new instance of the NetEventRelayBinding class.

System_CAPS_pubmethodNetEventRelayBinding(EndToEndSecurityMode, RelayEventSubscriberAuthenticationType)

Initializes a new instance of the NetEventRelayBinding class, using the specified security mode and relay client authentication type.

System_CAPS_protmethodNetEventRelayBinding(RelayedOnewayTransportBindingElement, BinaryMessageEncodingBindingElement, NetOnewayRelaySecurity)

Initializes a new instance of the NetEventRelayBinding class, using the specified transport, encoding, and security elements.

System_CAPS_pubmethodNetEventRelayBinding(String)

Initializes a new instance of the NetEventRelayBinding class, using the specified configuration.

NameDescription
System_CAPS_pubpropertyCloseTimeout

(Inherited from Binding.)

System_CAPS_pubpropertyEnvelopeVersion

Gets the version of SOAP that is used for messages processed by this binding.(Inherited from NetOnewayRelayBinding.)

System_CAPS_pubpropertyListenBacklog

Gets or sets the maximum number of queued connection requests that can be pending.(Inherited from NetOnewayRelayBinding.)

System_CAPS_pubpropertyMaxBufferPoolSize

Gets or sets the maximum size allowed for a buffer pool that stores messages processed by the binding.(Inherited from NetOnewayRelayBinding.)

System_CAPS_pubpropertyMaxBufferSize

Gets or sets a value that specifies the maximum size, in bytes, of the buffer used to store messages in memory.(Inherited from NetOnewayRelayBinding.)

System_CAPS_pubpropertyMaxConnections

Gets or sets a value that controls the maximum number of connections to be pooled for subsequent reuse on the client and the maximum number of connections allowed to be pending dispatch on the server.(Inherited from NetOnewayRelayBinding.)

System_CAPS_pubpropertyMaxReceivedMessageSize

Gets or sets the maximum size for a received message that is processed by the binding.(Inherited from NetOnewayRelayBinding.)

System_CAPS_protpropertyMessageSecurityVersion

Gets the message security version.(Inherited from NetOnewayRelayBinding.)

System_CAPS_pubpropertyMessageVersion

(Inherited from Binding.)

System_CAPS_pubpropertyName

(Inherited from Binding.)

System_CAPS_pubpropertyNamespace

(Inherited from Binding.)

System_CAPS_pubpropertyOpenTimeout

(Inherited from Binding.)

System_CAPS_pubpropertyReaderQuotas

Gets or sets constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding.(Inherited from NetOnewayRelayBinding.)

System_CAPS_pubpropertyReceiveTimeout

(Inherited from Binding.)

System_CAPS_pubpropertyScheme

Gets the URI scheme for the transport.(Inherited from NetOnewayRelayBinding.)

System_CAPS_pubpropertySecurity

Gets an object that specifies the type of security used with services configured with this binding.(Inherited from NetOnewayRelayBinding.)

System_CAPS_pubpropertySendTimeout

(Inherited from Binding.)

NameDescription
System_CAPS_protmethodApplyConfiguration(String)

Applies the settings from the configuration element that corresponds to the specified name to the current instance of this binding element.(Overrides NetOnewayRelayBinding.ApplyConfiguration(String).)

System_CAPS_pubmethodBuildChannelFactory<TChannel>(BindingParameterCollection)

(Inherited from Binding.)

System_CAPS_pubmethodBuildChannelFactory<TChannel>(Object[])

(Inherited from Binding.)

System_CAPS_pubmethodBuildChannelListener<TChannel>(BindingParameterCollection)

(Inherited from Binding.)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Object[])

(Inherited from Binding.)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, BindingParameterCollection)

(Inherited from Binding.)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, Object[])

(Inherited from Binding.)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, String, BindingParameterCollection)

(Inherited from Binding.)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, String, ListenUriMode, BindingParameterCollection)

(Inherited from Binding.)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, String, ListenUriMode, Object[])

(Inherited from Binding.)

System_CAPS_pubmethodBuildChannelListener<TChannel>(Uri, String, Object[])

(Inherited from Binding.)

System_CAPS_pubmethodCanBuildChannelFactory<TChannel>(BindingParameterCollection)

(Inherited from Binding.)

System_CAPS_pubmethodCanBuildChannelFactory<TChannel>(Object[])

(Inherited from Binding.)

System_CAPS_pubmethodCanBuildChannelListener<TChannel>(BindingParameterCollection)

(Inherited from Binding.)

System_CAPS_pubmethodCanBuildChannelListener<TChannel>(Object[])

(Inherited from Binding.)

System_CAPS_pubmethodCreateBindingElements()

Creates a set of binding elements.(Inherited from NetOnewayRelayBinding.)

System_CAPS_pubmethodEquals(Object)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_pubmethodGetProperty<T>(BindingParameterCollection)

(Inherited from Binding.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_protmethodIsBindingElementsMatch(RelayedOnewayTransportBindingElement, BinaryMessageEncodingBindingElement, ReliableSessionBindingElement)

Retrieves a value that determines if the specified binding elements match the current instance.

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

NameDescription
System_CAPS_protfieldencoding

Represents the encoding for the binding. Along with the security settings and transport type, the encoding represents the three core properties of a binding.(Inherited from NetOnewayRelayBinding.)

System_CAPS_protfieldtransport

Specifies the transport type for the binding. Along with the encoding and security settings, the transport type represents the three core properties of a binding.(Inherited from NetOnewayRelayBinding.)

Microsoft Azure Service Bus supports only Full Trust code access security.

System_CAPS_noteNote

By default, NetEventRelayBinding uses Transport Security.

NetEventRelayBinding is derived from NetOnewayRelayBinding. As such, NetEventRelayBinding inherits the properties of NetOnewayRelayBinding and shares much of its underlying infrastructure with this binding.

Unlike any of the other Relay bindings, the NetEventRelayBinding supports multiple listeners on the same URI. To set up an event rendezvous point (also called topic), the clients and listeners merely need to agree on a shared URI within the scope of a solution and send to or listen on it. Messages that get sent by any of the clients get distributed to all listeners.

For the current release, the number of listeners is constrained to fit departmental scenarios with fewer than 20 concurrent listeners. Messages sent through this binding are constrained to at most 60KB in wire size.

There are no assurances about messages arriving in sequence or being delivered at all.

With its default settings, the NetEventRelayBinding supports SOAP 1.2 messaging over TCP using .NET Framing and .NET Binary Serialization.

Services and Clients using the NetEventRelayBinding register their endpoints with Service Bus using the "sb" URI scheme, regardless of the active connectivity mode.

The channel is SSL-protected if the Security.Mode property is set to one of the EndToEndSecurityMode values of Transport or TransportWithMessageCredential.

The transport channel protection guards all traffic to and from the Relay, but the data is visible to (but not observed by) the Service Bus infrastructure at the socket relay point.

The following example shows how to define and use NetEventRelayBinding with the default configuration for a service and client in an application configuration file.

<system.serviceModel>

  <bindings>
    <netEventRelayBinding>
      <binding name="default" />
    </netEventRelayBinding>
  </bindings>

  <client>
    <endpoint name="RelayEndpoint"
              contract="Microsoft.ServiceBus.Samples.IMulticastContract"
              binding="netEventRelayBinding"
              bindingConfiguration="default"
              behaviorConfiguration="ReplaceWithEndpointBehaviorName"
              address="ReplaceWithEndpointAddress" />
  </client>

  <services>
    <service name="Microsoft.ServiceBus.Samples.MulticastService">
      <!-- Keep address empty to use host base address, or -->
      <!-- replace with endpoint address. -->
      <endpoint name="RelayEndpoint"
                contract="Microsoft.ServiceBus.Samples.IMulticastContract"
                binding="netEventRelayBinding"
                bindingConfiguration="default"
                behaviorConfiguration="ReplaceWithEndpointBehaviorName"
                address="" />
    </service>
  </services>

  <behaviors>
    <endpointBehaviors>
      <!-- Add endpoint behavior here. -->
    </endpointBehaviors>
  </behaviors>

</system.serviceModel>

The following example is similar to the previous example except that it defines a custom configuration for NetEventRelayBinding. It turns client authentication off, which means that the client is not required to present a security token to Service Bus.

<system.serviceModel>

  <bindings>
    <!-- Application Binding -->
    <netEventRelayBinding>
        <!-- Turn off client authentication -->
      <binding name="customBinding">
        <security relayClientAuthenticationType="None" />
    </netEventRelayBinding>
  </bindings>

  <client>
    <!-- No behavior configuration is added to this endpoint as the client does not need to authenticate. -->
    <endpoint name="RelayEndpoint"
              contract="Microsoft.ServiceBus.Samples.IMulticastContract"
              binding="netEventRelayBinding"
              bindingConfiguration="customBinding"
              address="ReplaceWithEndpointAddress" />
  </client>

  <services>
    <service name="Microsoft.ServiceBus.Samples.MulticastService">
      <!-- Keep address empty to use host base address, or -->
      <!-- replace with endpoint address. -->
      <endpoint name="RelayEndpoint"
                contract="Microsoft.ServiceBus.Samples.IMulticastContract"
                binding="netEventRelayBinding"
                bindingConfiguration="customBinding"
                behaviorConfiguration="ReplaceWithEndpointBehaviorName"
                address="" />
    </service>
  </services>

  <behaviors>
    <endpointBehaviors>
      <!-- Add endpoint behavior here. -->
    </endpointBehaviors>
  </behaviors>

</system.serviceModel>

The following example illustrates the use of NetEventRelayBinding programmatically with its default settings. The default settings of NetEventRelayBinding for the end-to-end security mode and client authentication type are EndToEndSecurityMode.Transport and RelayClientAuthenticationType.RelayAccessToken respectively. This example is a modified version of the Net Event sample, which specifies the binding for the service endpoint and the client channel programmatically instead of specifying it in the application configuration file. The Multicast SDK sample is a chat application that uses the NetEventRelayBinding.

The example starts by specifying the credentials the service and the client are expected to send to Service Bus by creating an endpoint behavior. Next, it creates the binding, the service address, and starts the Multicast service host. After starting the service, a channel factory is created for the IMulticastChannel channel type that is used to generate a client channel to the service. Finally, the client channel is opened.

// Configure the credentials for the service and client endpoints through an endpoint behavior.
TransportClientEndpointBehavior relayCredentials = new TransportClientEndpointBehavior();
relayCredentials.TokenProvider = 
  TokenProvider.CreateSharedAccessSignatureTokenProvider(keyName, key);




// Create the binding with default settings.
NetEventRelayBinding binding = new NetEventRelayBinding();        

// Get the service URI.
Uri serviceAddress = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace,
       String.Format(CultureInfo.InvariantCulture, "{0}/MulticastService/", session));

// Create the Multicast service host.
ServiceHost host = new ServiceHost(typeof(MulticastService), serviceAddress);
// Add the service endpoint with the NetEventRelayBinding binding.
host.AddServiceEndpoint(typeof(IMulticastContract), binding, serviceAddress);
// Add the credentials through the endpoint behavior.
host.Description.Endpoints[0].Behaviors.Add(relayCredentials);
// Start the service.
host.Open();

// Create a channel factory for the IMulticastChannel channel type.
// This channel factory is used to create client channels to the Multicast service. 
// Each client channel the channel factory creates is configured to use the 
// NetEventRelayBinding that is passed to the constructor of the channel factory.
ChannelFactory<IMulticastChannel> channelFactory = new ChannelFactory<IMulticastChannel>(
    binding, new EndpointAddress(serviceAddress));
channelFactory.Endpoint.Behaviors.Add(relayCredentials);

// Create and open the client channel.
IMulticastChannel channel = channelFactory.CreateChannel();
channel.Open();

The following example is similar to the previous example except that it uses NetEventRelayBinding with custom settings. It turns off client authentication, which means that the client is not required to present a security token to Service Bus. Since the client is not required to authenticate, no endpoint behavior for the credentials is added to the client channel. Note that the behavior is still added to the service endpoint because the service application always authenticates with Service Bus.

// Configure the credentials for the service and client endpoints through an endpoint behavior.
TransportClientEndpointBehavior relayCredentials = new TransportClientEndpointBehavior();
relayCredentials.TokenProvider = 
  TokenProvider.CreateSharedAccessSignatureTokenProvider(keyName, key);




// Create the binding with custom settings.
NetEventRelayBinding binding = new NetEventRelayBinding();        
// The client is not required to present a security token to the AppFabric Service Bus.
binding.Security.RelayClientAuthenticationType = RelayClientAuthenticationType.None;

// Get the service URI.
Uri serviceAddress = ServiceBusEnvironment.CreateServiceUri("sb", serviceNamespace,
       String.Format(CultureInfo.InvariantCulture, "{0}/MulticastService/", session));

// Create the Multicast service host.
ServiceHost host = new ServiceHost(typeof(MulticastService), serviceAddress);
// Add the service endpoint with the NetEventRelayBinding binding.
host.AddServiceEndpoint(typeof(IMulticastContract), binding, serviceAddress);
// Add the credentials through the endpoint behavior.
host.Description.Endpoints[0].Behaviors.Add(relayCredentials);
// Start the service.
host.Open();

// Create a channel factory for the IMulticastChannel channel type.
// This channel factory is used to create client channels to the Multicast service. 
// Each client channel the channel factory creates is configured to use the 
// NetEventRelayBinding that is passed to the constructor of the channel factory.
ChannelFactory<IMulticastChannel> channelFactory = new ChannelFactory<IMulticastChannel>(
    binding, new EndpointAddress(serviceAddress));

// Create and open the client channel.
IMulticastChannel channel = channelFactory.CreateChannel();
channel.Open();

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show:
© 2016 Microsoft