Comments (3)
you need to use RestartSink ,if you want your sink to restart when the connection drops, so the sink will be recreated with new connection to rabbit. Also u can combine them with KillSwitch so you can also gracefully stop.
something like this:
var source = Source.Queue<string>(0, OverflowStrategy.Backpressure);
var restartSink = RestartSink.WithBackoff(() =>
{
Console.WriteLine("Restarting AMQP Sink.");
var amqpSink = AmqpSink.CreateSimple(
AmqpSinkSettings.Create(connectionSettings)
.WithRoutingKey(queueName)
.WithDeclarations(queueDeclaration,bindingDeclaration,exchangeDeclaration));
return amqpSink;
}, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(5), 0.2);
var tupple = source
.Select(ByteString.FromString)
.ViaMaterialized(KillSwitches.Single<ByteString>(),Keep.Both)
.ToMaterialized(restartSink,Keep.Left)
.Run(mat);
var sinkKillSwitch = tupple.Item2;
var queueSource = tupple.Item1;
sinkKillSwitch.Shutdown();
from alpakka.
@bobanco Excellent, thanks! :) I completely forgot about RestartSink
however read about it a week ago.
It works, but it uncover a bug in PostStop
:
[ERROR][17-Jan-18 19:46:30][Thread 0003][[akka://test/user/StreamSupervisor-0/Flow-0-0-unknown-operation#1059276845]] Error during PostStop in [AmqpSink]
Cause: System.NullReferenceException: Object reference not set to an instance of an object.
at Akka.Streams.Amqp.AmqpSinkStage.AmqpSinkStageLogic.PostStop()
at Akka.Streams.Implementation.Fusing.GraphInterpreter.FinalizeStage(GraphStageLogic logic)
from alpakka.
The NRE is fixed in #23
from alpakka.
Related Issues (20)
- Merge `Akka.Streams.Azure.EventHub.V5` into `Akka.Streams.Azure.EventHub`
- QueueSource does not remove processed messages from the Azure Storage Queue HOT 3
- Please indicate that the Azure Storage Queue Stream consumer is to delete consumed messages from the Azure Queue HOT 2
- IndexOutOfRangeException happens when trying to get the queue message HOT 3
- Akka.Streams.Azure.EventHub.V5 batching processing not working as expected
- Use Akka.net as SignalR Backplane
- Using AmqpConnectionDetails with SSL enabled always results with "localhost" endpoint HOT 7
- NullReferenceException - when using Akka.Net v1.5.12 and Akka.Streams.Amqp.RabbitMq v1.5.8 HOT 3
- Add nightly build support HOT 3
- Remove Alpakka Channel Stages
- Add nats-net-v2 Connectors
- Amqp Connector don't work with RestartSource HOT 11
- Manual commit Azure EventHub source feature
- DockerClient.Images.ListImagesAsync() could not use MatchName anymore.
- Flaky tests when transient error/delay happens HOT 1
- Need to migrate SignalR.Core packages to Microsoft.AspNet.SignalR HOT 2
- More frequent releases HOT 2
- Akka.Streams.EventHubs uses a deprecated Azure SDK (WindowsAzure.ServiceBus 6.2.0) HOT 11
- [Docs] need to explain when to use Akka.Streams.RabbitMQ vs Akka.Streams.AMQP HOT 3
- Akka.Streams.Channels ChannelSource is failing in the middle of processing with TaskCanceledException HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alpakka.