-
-
Save budiadiono/4275294 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static int GetRoleInstanceNumber() | |
{ | |
var roleInstanceId = RoleEnvironment.CurrentRoleInstance.Id; | |
var li1 = roleInstanceId.LastIndexOf("."); | |
var li2 = roleInstanceId.LastIndexOf("_"); | |
var roleInstanceNo = roleInstanceId.Substring(Math.Max(li1, li2) + 1); | |
return Int32.Parse(roleInstanceNo); | |
} | |
string connectionString = // Your connection string | |
int numTopics = 2; | |
int instanceCount = 2; | |
int instanceId = GetRoleInstanceNumber(); | |
string topicPrefix = "MyApplicationName"; | |
GlobalHost.DependencyResolver.UseServiceBus( | |
connectionString, | |
numTopics, | |
instanceCount, | |
instanceId, | |
topicPrefix | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment