• No se han encontrado resultados

10 ANEXOS

10.5 Anexo 5. Entrevistas a padres completo

Data and Message Contracts Service Contracts

Client Application

Response Handler Service ListenUri Endpoint Behavior SessionChannel Endpoint Behavior Property Schemas

Schemas

Service Bus Message Inspector Installing Components in GAC

Registering Components in the machine.config file Receive Locations

Send Ports Orchestrations

Queues, Topics and Subscriptions

The first operation to perform to properly configure the environment is creating the messaging entities used by the demo. The first operation to execute is to provision a new Service Bus namespace or modify an existing namespace to include the Service Bus. You can accomplish

this ta

You can use the navigation tree-view shown at point 2 to select an existing entity and display its properties in the vertical bar highlighted at point 3. To remove the selected entity, you press the Delete button in the Manage Entities command bar.

The current user interface supplied by the Windows Azure Management Portal allows a user to create queues, topics, and subscriptions and define their properties, but not to create or display rules for an existing subscription. At the moment, you can accomplish this task by only using the .NET messaging API. In particular, to add a new rule to an existing subscription you can use the AddRule(String, Filter) or the

AddRule(RuleDescription) methods exposed by the SubscriptionClient class, whereas to enumerate the rules of an existing subscription, you can use the GetRules method of the NamespaceManager class. The latter can be used for managing entities, such as

queues, topics, subscriptions, and rules, in a Service Bus namespace.In June, I created a tool called Service Bus Explorer that allows a user to create, delete and test queues, topics, subscriptions, and rules. My tool was able to manage entities in the AppFabric Labs Beta environment. However, the new version of the Service Bus API introduced some breaking changes, as you can read here, so I'm working at a new version of the Service Bus Explorer tool that will introduce a significant amount of interesting and hopefully useful features. So stay tuned and come back frequently on this site as I plan to publish it soon.

For your convenience, I created a console application called Provisioning that uses the functionality provided by the NamespaceManager class to create the queues, topics, and

subscriptions required by the solution. When it starts, the console applications prompt for service namespace credentials. These are used to authenticate with the Access Control service, and acquire an access token that proves to the Service Bus infrastructure that the application is authorized to provision new messaging entities. Then the application prompts for the value to assign to the properties of the entities to create such as EnabledBatchedOperations and

EnableDeadLetteringOnMessageExpiration for queues. The Provisioning application creates the following entities in the specified Service Bus namespace:

 A queue called requestqueue used by the client application to send request messages to BizTalk Server.

 A queue called responsequeue used by BizTalk Server to send response messages to the client application.

 A topic called requesttopic used by the client application to send request messages to BizTalk Server.

 A topic called responsetopic used by BizTalk Server to send response messages to the client application.

 A subscription called ItalyMilan for the requesttopic. The latter is used by BizTalk Server to receive request messages from the requesttopic. The subscription in question has a single rule defined as follows:

a. Filter: Country='Italy' and City='Milan'

b. Action: Set Area='Western Europe'

Note

 A

// Constants

//***************************

private const string RequestQueue = "requestqueue";

private const string ResponseQueue = "responsequeue";

private const string RequestTopic = "requesttopic";

private const string ResponseTopic = "responsetopic";

private const string RequestSubscription = "ItalyMilan";

private const string ResponseSubscription = "ItalyMilan";

#endregion

static void Main() {

var defaultColor = Console.ForegroundColor;

try {

// Set Window Size

Console.WindowWidth = 100;

Console.BufferWidth = 100;

Console.WindowHeight = 48;

Console.BufferHeight = 48;

// Print Header

Console.WriteLine("Read Credentials:");

Console.WriteLine("---");

// Read Service Bus Namespace

Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Service Bus Namespace: ");

Console.ForegroundColor = defaultColor;

var serviceNamespace = Console.ReadLine();

// Read Service Bus Issuer Name

Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Service Bus Issuer Name: ");

Console.ForegroundColor = defaultColor;

var issuerName = Console.ReadLine();

// Read Service Bus Issuer Secret

Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Service Bus Issuer Secret: ");

var issuerSecret = Console.ReadLine();

// Print Header Console.WriteLine();

Console.WriteLine("Enter Queues Properties:");

Console.WriteLine("---");

// Read Queue EnabledBatchedOperations Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Queues: ");

Console.ForegroundColor = defaultColor;

Console.Write("Set the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write("EnabledBatchedOperations ");

Console.ForegroundColor = defaultColor;

Console.Write("to true [y=Yes, n=No]?");

var key = Console.ReadKey().KeyChar;

var queueEnabledBatchedOperations = key == 'y' || key == 'Y';

Console.WriteLine();

// Read Queue EnableDeadLetteringOnMessageExpiration Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Queues: ");

Console.ForegroundColor = defaultColor;

Console.Write("Set the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write("EnableDeadLetteringOnMessageExpiration ");

Console.ForegroundColor = defaultColor;

Console.Write("to true [y=Yes, n=No]?");

key = Console.ReadKey().KeyChar;

var queueEnableDeadLetteringOnMessageExpiration = key == 'y' || key ==

'Y';

Console.WriteLine();

// Read Queue RequiresDuplicateDetection Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Queues: ");

Console.ForegroundColor = defaultColor;

Console.Write("Set the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write("RequiresDuplicateDetection ");

Console.Write("to true [y=Yes, n=No]?");

key = Console.ReadKey().KeyChar;

var queueRequiresDuplicateDetection = key == 'y' || key == 'Y';

Console.WriteLine();

// Read Queue RequiresSession

Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Queues: ");

Console.ForegroundColor = defaultColor;

Console.Write("Set the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write("RequiresSession ");

Console.ForegroundColor = defaultColor;

Console.Write("to true [y=Yes, n=No]?");

key = Console.ReadKey().KeyChar;

var queueRequiresSession = key == 'y' || key == 'Y';

Console.WriteLine();

// Print Header Console.WriteLine();

Console.WriteLine("Enter Topic Properties:");

Console.WriteLine("---");

// Read Topic EnabledBatchedOperations Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Topics: ");

Console.ForegroundColor = defaultColor;

Console.Write("Set the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write("EnabledBatchedOperations ");

Console.ForegroundColor = defaultColor;

Console.Write("to true [y=Yes, n=No]?");

key = Console.ReadKey().KeyChar;

var topicEnabledBatchedOperations = key == 'y' || key == 'Y';

Console.WriteLine();

// Read Topic RequiresDuplicateDetection Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Topics: ");

Console.ForegroundColor = defaultColor;

Console.Write("Set the ");

Console.Write("RequiresDuplicateDetection ");

Console.ForegroundColor = defaultColor;

Console.Write("to true [y=Yes, n=No]?");

key = Console.ReadKey().KeyChar;

var topicRequiresDuplicateDetection = key == 'y' || key == 'Y';

Console.WriteLine();

// Print Header Console.WriteLine();

Console.WriteLine("Enter Subscriptions Properties: ");

Console.WriteLine("---");

// Read Subscription EnabledBatchedOperations Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Subscriptions: ");

Console.ForegroundColor = defaultColor;

Console.Write("Set the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write("EnabledBatchedOperations ");

Console.ForegroundColor = defaultColor;

Console.Write("to true [y=Yes, n=No]?");

key = Console.ReadKey().KeyChar;

var subscriptionnabledBatchedOperations = key == 'y' || key == 'Y';

Console.WriteLine();

// Read Subscription EnableDeadLetteringOnFilterEvaluationExceptions Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Subscriptions: ");

Console.ForegroundColor = defaultColor;

Console.Write("Set the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write("EnableDeadLetteringOnFilterEvaluationExceptions ");

Console.ForegroundColor = defaultColor;

Console.Write("to true [y=Yes, n=No]?");

key = Console.ReadKey().KeyChar;

var subscriptionEnableDeadLetteringOnFilterEvaluationExceptions = key ==

'y' || key == 'Y';

Console.WriteLine();

// Read Subscription EnableDeadLetteringOnMessageExpiration Console.ForegroundColor = ConsoleColor.Green;

Console.ForegroundColor = defaultColor;

Console.Write("Set the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write("EnableDeadLetteringOnMessageExpiration ");

Console.ForegroundColor = defaultColor;

Console.Write("to true [y=Yes, n=No]?");

key = Console.ReadKey().KeyChar;

var subscriptionEnableDeadLetteringOnMessageExpiration = key == 'y' ||

key == 'Y';

Console.WriteLine();

// Read Subscription RequiresSession

Console.ForegroundColor = ConsoleColor.Green;

Console.Write("Subscriptions: ");

Console.ForegroundColor = defaultColor;

Console.Write("Set the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write("RequiresSession ");

Console.ForegroundColor = defaultColor;

Console.Write("to true [y=Yes, n=No]?");

key = Console.ReadKey().KeyChar;

var subscriptionRequiresSession = key == 'y' || key == 'Y';

Console.WriteLine();

// Get ServiceBusNamespaceClient for management operations var managementUri =

ServiceBusEnvironment.CreateServiceUri("https", serviceNamespace, string.Empty);

var tokenProvider =

TokenProvider.CreateSharedSecretTokenProvider(issuerName, issuerSecret);

var namespaceManager = new NamespaceManager(managementUri, tokenProvider);

// Print Header Console.WriteLine();

Console.WriteLine("Create Queues:");

Console.WriteLine("---");

// Create RequestQueue Console.Write("Creating ");

Console.Write(RequestQueue);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" queue...");

if (namespaceManager.QueueExists(RequestQueue)) {

namespaceManager.DeleteQueue(RequestQueue);

}

namespaceManager.CreateQueue(new QueueDescription(RequestQueue) {

EnableBatchedOperations = queueEnabledBatchedOperations,

EnableDeadLetteringOnMessageExpiration =

queueEnableDeadLetteringOnMessageExpiration, RequiresDuplicateDetection =

queueRequiresDuplicateDetection,

RequiresSession = queueRequiresSession });

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(RequestQueue);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" queue successfully created.");

// Create ResponseQueue Console.Write("Creating ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(ResponseQueue);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" queue...");

if (namespaceManager.QueueExists(ResponseQueue)) {

namespaceManager.DeleteQueue(ResponseQueue);

}

namespaceManager.CreateQueue(new QueueDescription(ResponseQueue) {

EnableBatchedOperations = queueEnabledBatchedOperations, EnableDeadLetteringOnMessageExpiration =

queueEnableDeadLetteringOnMessageExpiration, RequiresDuplicateDetection =

queueRequiresDuplicateDetection,

RequiresSession = queueRequiresSession });

Console.Write(ResponseQueue);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" queue successfully created.");

// Print Header Console.WriteLine();

Console.WriteLine("Create Topics:");

Console.WriteLine("---");

// Create RequestTopic Console.Write("Creating ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(RequestTopic);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" topic...");

if (namespaceManager.TopicExists(RequestTopic)) {

namespaceManager.DeleteTopic(RequestTopic);

}

namespaceManager.CreateTopic(new TopicDescription(RequestTopic) {

EnableBatchedOperations = topicEnabledBatchedOperations,

RequiresDuplicateDetection = topicRequiresDuplicateDetection

});

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(RequestTopic);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" topic successfully created.");

// Create ResponseTopic Console.Write("Creating ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(ResponseTopic);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" topic...");

if (namespaceManager.TopicExists(ResponseTopic)) {

namespaceManager.DeleteTopic(ResponseTopic);

}

{

EnableBatchedOperations = topicEnabledBatchedOperations,

RequiresDuplicateDetection = topicRequiresDuplicateDetection

});

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(ResponseTopic);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" topic successfully created.");

// Print Header Console.WriteLine();

Console.WriteLine("Create Subscriptions:");

Console.WriteLine("---");

// Create Request Subscription Console.Write("Creating ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(RequestSubscription);

Console.ForegroundColor = defaultColor;

Console.Write(" subscription for the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(RequestTopic);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" topic...");

var ruleDescription = new RuleDescription(new SqlFilter("Country='Italy' and City='Milan'"))

{

Name = "$Default",

Action = new SqlRuleAction("Set Area='Western Europe'")

};

var subscriptionDescription = new SubscriptionDescription(RequestTopic, RequestSubscription)

{

EnableBatchedOperations = subscriptionnabledBatchedOperations, EnableDeadLetteringOnFilterEvaluationExceptions =

subscriptionEnableDeadLetteringOnFilterEvaluationExceptions, EnableDeadLetteringOnMessageExpiration =

subscriptionEnableDeadLetteringOnMessageExpiration,

};

namespaceManager.CreateSubscription(subscriptionDescription, ruleDescription);

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(RequestSubscription);

Console.ForegroundColor = defaultColor;

Console.Write(" subscription for the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(RequestTopic);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" topic successfully created.");

// Create Response Subscription Console.Write("Creating ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(ResponseSubscription);

Console.ForegroundColor = defaultColor;

Console.Write(" subscription for the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(ResponseTopic);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" topic...");

ruleDescription = new RuleDescription(new SqlFilter("Country='Italy' and City='Milan'"))

{

Action = new SqlRuleAction("Set Area='Western Europe'")

};

subscriptionDescription = new SubscriptionDescription(ResponseTopic, ResponseSubscription)

{

EnableBatchedOperations = subscriptionnabledBatchedOperations, EnableDeadLetteringOnFilterEvaluationExceptions =

subscriptionEnableDeadLetteringOnFilterEvaluationExceptions, EnableDeadLetteringOnMessageExpiration =

subscriptionEnableDeadLetteringOnMessageExpiration, RequiresSession = subscriptionRequiresSession

};

namespaceManager.CreateSubscription(subscriptionDescription, ruleDescription);

Console.ForegroundColor = ConsoleColor.Yellow;

Console.ForegroundColor = defaultColor;

Console.Write(" subscription for the ");

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write(ResponseTopic);

Console.ForegroundColor = defaultColor;

Console.WriteLine(" topic successfully created.");

Console.WriteLine();

// Close the application

Console.WriteLine("Press any key to continue ...");

Console.ReadLine();

}

catch (Exception ex) {

Console.ForegroundColor = ConsoleColor.Yellow;

Console.Write("Exception: ");

Console.ForegroundColor = defaultColor;

Console.Write(ex.Message);

} } } }

I did not test all the possible combinations of properties for queues and topics so the demo may not work as expected with all the configurations.