Eksportér (0) Udskriv
Udvid alt
EN
Dette indhold er ikke tilgængeligt på dit sprog, men her er den engelske version.

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)

public class NetEventRelayBinding : NetOnewayRelayBinding, 
	IBindingRuntimePreferences

The NetEventRelayBinding type exposes the following members.

  NameDescription
Public methodNetEventRelayBinding()Initializes a new instance of the NetEventRelayBinding class.
Public methodNetEventRelayBinding(String)Initializes a new instance of the NetEventRelayBinding class, using the specified configuration.
Public methodNetEventRelayBinding(EndToEndSecurityMode, RelayEventSubscriberAuthenticationType)Initializes a new instance of the NetEventRelayBinding class, using the specified security mode and relay client authentication type.
Protected methodNetEventRelayBinding(RelayedOnewayTransportBindingElement, BinaryMessageEncodingBindingElement, NetOnewayRelaySecurity)Initializes a new instance of the NetEventRelayBinding class, using the specified transport, encoding, and security elements.
Top

  NameDescription
Public propertyCloseTimeout (Inherited from Binding.)
Public propertyEnvelopeVersionGets the version of SOAP that is used for messages processed by this binding. (Inherited from NetOnewayRelayBinding.)
Public propertyListenBacklogGets or sets the maximum number of queued connection requests that can be pending. (Inherited from NetOnewayRelayBinding.)
Public propertyMaxBufferPoolSizeGets or sets the maximum size allowed for a buffer pool that stores messages processed by the binding. (Inherited from NetOnewayRelayBinding.)
Public propertyMaxBufferSizeGets or sets a value that specifies the maximum size, in bytes, of the buffer used to store messages in memory. (Inherited from NetOnewayRelayBinding.)
Public propertyMaxConnectionsGets 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.)
Public propertyMaxReceivedMessageSizeGets or sets the maximum size for a received message that is processed by the binding. (Inherited from NetOnewayRelayBinding.)
Protected propertyMessageSecurityVersionGets the message security version. (Inherited from NetOnewayRelayBinding.)
Public propertyMessageVersion (Inherited from Binding.)
Public propertyName (Inherited from Binding.)
Public propertyNamespace (Inherited from Binding.)
Public propertyOpenTimeout (Inherited from Binding.)
Public propertyReaderQuotasGets or sets constraints on the complexity of SOAP messages that can be processed by endpoints configured with this binding. (Inherited from NetOnewayRelayBinding.)
Public propertyReceiveTimeout (Inherited from Binding.)
Public propertySchemeGets the URI scheme for the transport. (Inherited from NetOnewayRelayBinding.)
Public propertySecurityGets an object that specifies the type of security used with services configured with this binding. (Inherited from NetOnewayRelayBinding.)
Public propertySendTimeout (Inherited from Binding.)
Top

  NameDescription
Protected methodApplyConfigurationApplies the settings from the configuration element that corresponds to the specified name to the current instance of this binding element. (Overrides NetOnewayRelayBinding.ApplyConfiguration(String).)
Public methodBuildChannelFactory<TChannel>(Object[]) (Inherited from Binding.)
Public methodBuildChannelFactory<TChannel>(BindingParameterCollection) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Object[]) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(BindingParameterCollection) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, Object[]) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, BindingParameterCollection) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, String, Object[]) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, String, BindingParameterCollection) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, String, ListenUriMode, Object[]) (Inherited from Binding.)
Public methodBuildChannelListener<TChannel>(Uri, String, ListenUriMode, BindingParameterCollection) (Inherited from Binding.)
Public methodCanBuildChannelFactory<TChannel>(Object[]) (Inherited from Binding.)
Public methodCanBuildChannelFactory<TChannel>(BindingParameterCollection) (Inherited from Binding.)
Public methodCanBuildChannelListener<TChannel>(Object[]) (Inherited from Binding.)
Public methodCanBuildChannelListener<TChannel>(BindingParameterCollection) (Inherited from Binding.)
Public methodCreateBindingElementsCreates a set of binding elements. (Inherited from NetOnewayRelayBinding.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetProperty<T> (Inherited from Binding.)
Public methodGetType (Inherited from Object.)
Protected methodIsBindingElementsMatchRetrieves a value that determines if the specified binding elements match the current instance.
Protected methodMemberwiseClone (Inherited from Object.)
Public methodShouldSerializeName (Inherited from Binding.)
Public methodShouldSerializeNamespace (Inherited from Binding.)
Public methodToString (Inherited from Object.)
Top

  NameDescription
Protected fieldencodingRepresents 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.)
Protected fieldtransportSpecifies 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.)
Top

  NameDescription
Explicit interface implemetationPrivate propertyIBindingRuntimePreferences.ReceiveSynchronouslyGets a value that indicates whether incoming requests can be handled more efficiently synchronously or asynchronously. (Inherited from NetOnewayRelayBinding.)
Top

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

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 on the Windows Azure 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 Windows Azure 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 the Windows Azure 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 Multicast SDK 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 and can be found in the SDK install directory under \Samples\ServiceBus\ExploringFeatures\Bindings\NetEvent.

This example starts by specifying the credentials the service and the client are expected to send to the Windows Azure 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.CredentialType = TransportClientCredentialType.SharedSecret;
relayCredentials.Credentials.SharedSecret.IssuerName = issuerName;
relayCredentials.Credentials.SharedSecret.IssuerSecret = issuerSecret;

// 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 the Windows Azure 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 the Windows Azure Service Bus.

// Configure the credentials for the service and client endpoints through an endpoint behavior.
TransportClientEndpointBehavior relayCredentials = new TransportClientEndpointBehavior();
relayCredentials.CredentialType = TransportClientCredentialType.SharedSecret;
relayCredentials.Credentials.SharedSecret.IssuerName = issuerName;
relayCredentials.Credentials.SharedSecret.IssuerSecret = issuerSecret;

// 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.

Fællesskabsindhold

Tilføj
Vis:
© 2014 Microsoft