Here is also the test console application
class Program
{
static void Main(string[] args)
{
var host = new DefaultHost();
host.Start<BootStrapper>();
string line;
while ((line = Console.ReadLine().ToLower()) != "q")
{
int n;
if (int.TryParse(line, out n))
{
(host.Bus as IServiceBus).Send(new Start() { ActivityId
= n, CorrelationId = Guid.NewGuid() });
}
}
}
}
class BootStrapper : AutofacBootStrapper { }
and its configuration
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="rhino.esb"
type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus" />
</configSections>
<rhino.esb>
<bus threadCount="1"
numberOfRetries="5"
endpoint="msmq://localhost/rsb-retention.client" />
<messages>
<add name="MyNamespace.Start"
endpoint="msmq://localhost/rsb-retention" transactional="false" />
</messages>
</rhino.esb>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Rhino.Queues"
publicKeyToken="0b3305902db7183f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0"
/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
</configuration>
Dana utorak, 10. srpnja 2012. 16:58:01 UTC+2, korisnik Ivica Munitic
napisao je:
>
> Sorry for the email, I clicked the wrong button somewhere :)
>
> Here is the BootStrapper:
>
> public class BootStrapper : AutofacBootStrapper
> {
> protected override void ConfigureContainer()
> {
> base.ConfigureContainer();
>
> var builder = new ContainerBuilder();
>
> builder.RegisterGeneric(typeof(InMemorySagaPersister<>)).As(typeof(ISagaPersister<>));
> builder.Update(Container);
> }
>
> protected override void OnBeginStart()
> {
> base.OnBeginStart();
>
> XmlConfigurator.Configure();
> }
> }
>
> and here is the configuration of the bus
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <configSections>
> <section name="rhino.esb"
> type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus"/>
> <section name="log4net"
> type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
> </configSections>
>
> <rhino.esb>
> <bus threadCount="1" numberOfRetries="5"
> endpoint="msmq://localhost/rsb-retention" transactional="false" />
> <messages>
> <add name="MyNamespace.Timeout"
> endpoint="msmq://localhost/rsb-retention" transactional="false" />
> </messages>
> </rhino.esb>
>
> <log4net>
> <appender name="ConsoleAppender"
> type="log4net.Appender.ConsoleAppender">
> <layout type="log4net.Layout.PatternLayout">
> <conversionPattern value="%date [%thread] %-5level [%ndc] -
> %message%newline"/>
> </layout>
> </appender>
> <root>
> <level value="DEBUG"/>
> <appender-ref ref="ConsoleAppender"/>
> </root>
> </log4net>
> <runtime>
> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
> <dependentAssembly>
> <assemblyIdentity name="Rhino.Queues"
> publicKeyToken="0b3305902db7183f" culture="neutral" />
> <bindingRedirect oldVersion="0.0.0.0-1.4.1.0"
> newVersion="1.4.2.0"/>
> </dependentAssembly>
> </assemblyBinding>
> </runtime>
> </configuration>
>
>
> The assembly binding is because Rhino.ServiceBus.Host.exe works with
> Rhino.Qieies 1.4.1.0 :)
>
> Regards, Ivica
> Dana utorak, 10. srpnja 2012. 16:43:33 UTC+2, korisnik Corey napisao je:
>>
>> Which container? How are the consumers getting registered? Test code?
>> Your sample *should* work fine so the problem is likely with the container
>> or test code.
>>
>> On Tue, Jul 10, 2012 at 8:20 AM, Ivica Munitic <[email protected]>wrote:
>>
>>> Hello, I have a saga like this
>>>
>>> public class MySaga
>>> : ISaga<MySagaState>,
>>> InitiatedBy<Start>,
>>> Orchestrates<Timeout>
>>> {
>>> readonly IServiceBus _bus;
>>>
>>> public MySagaState State { get; set; }
>>>
>>> public Guid Id { get; set; }
>>> public bool IsCompleted { get; set; }
>>>
>>> public MySaga(IServiceBus bus)
>>> {
>>> _bus = bus;
>>> this.State = new MySagaState();
>>> }
>>>
>>> public void Consume(Start message)
>>> {
>>> State.ActivityId = message.ActivityId;
>>> _bus.DelaySendToSelf(DateTime.Now.AddSeconds(10), new
>>> Timeout() { CorrelationId = this.Id });
>>>
>>> }
>>>
>>> public void Consume(Timeout message)
>>> {
>>> _bus.Publish(new Expired() { ActivityId = State.ActivityId
>>> });
>>>
>>> IsCompleted = true;
>>> }
>>> }
>>>
>>> The problem I'm having is that the saga never consumes the Timeout
>>> message.
>>> the timeout message finishes in the discarded subqueue.
>>> The logs says that it did not get processed because there were no
>>> cosumers for it.
>>>
>>> I'm really confused.
>>>
>>> P.S.
>>>
>>> I'm using an InMemorySagaPersister to test this saga.
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Rhino Tools Dev" group.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msg/rhino-tools-dev/-/ZXvSpUGLfIMJ.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/rhino-tools-dev?hl=en.
>>>
>>
>>
--
You received this message because you are subscribed to the Google Groups
"Rhino Tools Dev" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/rhino-tools-dev/-/hp77kse_vgMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rhino-tools-dev?hl=en.