Ayende @ Wiki

Edit

Securing messages and values

You can configure the bus to encrypt either individual values or the full message. You can do this by using the WireEncryptedString type of an individual value, or by marking the message with IWireEncryptedMessage.

public class ClassWithSecretField
{
     public WireEncryptedString Secret { get; set; }
     public string NotSecret { get; set; }
}

public class SecretMessage : IWireEncryptedMessage { public int Id { get; set; } public string EvilFreeTextNoteThatShouldntContainSensitiveInformationButDoes { get; set; } public string AlsoEncryptedOnTheWire { get; set; } }


Samples of a wire format

<tests.classwithsecretfield:ClassWithSecretField>
    <datastructures.wireecryptedstring:ShouldBeEncrypted>
      <string:Value iv="FBZ+uao0xfazgE9+oQZEVw==">kf1DCWu5HQVBh0d+56rCTg==</string:Value>
    </datastructures.wireecryptedstring:ShouldBeEncrypted>
    <string:NotSecret>See not secret</string:NotSecret>
</tests.classwithsecretfield:ClassWithSecretField>

<tests.secretmessage:SecretMessage> <Value iv="220wmljTVVVgDL3lnOWAlA==" xmlns="string">VbeTjlyKBPTxLa6vgR4K5bqRKFCO9iCPFm68a4lXO3HEN0m9KoXXpR44JT1qx9rZMZBjFBieN/1sJQdNkx7+khv5QQiYfkHK/A+Kd/txpS6Iu+jhVxgyo
ToUkcYYq6nPMdGj3syAPAe0UckW6u10I1CrKdNlRlWtMgPjcR8mlicP1PprH0z3v88vvMaKriskUERQCwD0Wfd8MXDWJwb6hidkTZTYK0bm3mNR63ixsWs0TFzK+ec99yZ4C22Goki9</Value> </tests.secretmessage:SecretMessage>


To use security you must include the security section in the castle configuration.

...
</messages>
<security>
	<key>j/4dp8lkEOtkCUJF63UPftCIEtU4FbxNgFRvATRUHUk=</key>
</security>


Failing to add the security section will result in a SecurityException.
"Cannot send IWireEncryptedMessage when was not properly set up"
"Cannot send message containing WireEcryptedString when was not properly set up"

Edit

Configuring the bus

<?xml version="1.0"?>
<configuration>
	<configSections>
		<section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor"/>
	</configSections>
	<castle>
		<properties>
			<connectionString>Data Source=SQLNTS4;Initial Catalog=myapp;Integrated Security=SSPi;</connectionString>
			<myApp>
				<config>
					<user>foobur</user>
					<Password>****</Password>
				</config>
			</myApp>
		</properties>
		<facilities>
			<facility id="rhino.esb">
				<bus threadCount="1" numberOfRetries="5" logEndPoint="msmq://localhost/myApp.backend#logs" endpoint="msmq://localhost/myApp.backend"/>
				<messages>
					<add name="MyCompany.MyApp.Messages" endpoint="msmq://localhost/myApp.backend"/>
					<add name="MyCompany.MyApp.Backend" endpoint="msmq://localhost/myApp.backend"/>
				</messages>
				<security>
					<key>j/4dp8lkEOtkCUJF63UPftCIEtU4FbxNgFRvATRUHUk=</key>
				</security>
			</facility>
		</facilities>
		<components>
			<component id="DistributedHashTable">
				<parameters>
					<database>esb.esent</database>
				</parameters>
			</component>
		</components>
	</castle>
</configuration>


Edit

Configuring Load Balancer



The configuration for a stand alone load balancer is:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="castle"
             type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" />
  </configSections>

<castle> <facilities> <facility id="rhino.esb.loadbalancer" > <loadBalancer threadCount="1" endpoint="msmq://localhost/test_queue.balancer.standalone" /> </facility> </facilities> </castle> </configuration>


The configuration for a primary load balancer (that has a secondary):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="castle"
             type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" />
  </configSections>

<castle> <facilities> <facility id="rhino.esb.loadbalancer" > <loadBalancer threadCount="1" endpoint="msmq://localhost/test_queue.balancer.primary" secondaryLoadBalancerEndpoint="msmq://localhost/test_queue.balancer.secondary" /> </facility> </facilities> </castle> </configuration>


The configuration for a secondary load balancer (that watch the primary and know how to take over):

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="castle"
             type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" />
  </configSections>

<castle> <facilities> <facility id="rhino.esb.loadbalancer" > <loadBalancer threadCount="1" endpoint="msmq://localhost/test_queue.balancer.secondary" primaryLoadBalancerEndpoint="msmq://localhost/test_queue.balancer.primary" /> </facility> </facilities> </castle> </configuration>

ScrewTurn Wiki version 2.0 Beta. Some of the icons created by FamFamFam.