@Silv3rcircl3 Sorry, was out there. The relevant code for disposing the stream was this:
var materializer = Context.Materializer();
var source = StreamConverters.FromInputStream(() => stream, STREAM_CHUNK_SIZE)
.Select(bs => new ApiResultV1.ResourceChunkContainer(API_NAME, bs.ToArray()));
var sink = Sink.ActorRef<ApiResultV1.ResourceChunkContainer>(sendingProxy, new ApiResultV1.ResourceStreamCompleted(API_NAME, resourceId, "UTF-8"));
var result = source.To(sink)
.Run(materializer);
result.ContinueWith((task) =>
{
stream.Dispose();
if (task.Result.WasSuccessful)
{
log.Debug($"Successfully streamed {result.Result.Count} packages for '{resourceId}'");
}
else
{
log.Error(task.Result.Error, "Streaming failed");
}
});
When I dispose the materializer where the stream is disposed, the data does not get send at all.
actorSystem.ActorOf(ClusterSingletonManager.Props(
singletonProps: Props.Create<SingleActor>(), // Props used to create actor singleton
terminationMessage: PoisonPill.Instance, // message used to stop actor gracefully
settings: ClusterSingletonManagerSettings.Create(actorSystem).WithRole("workingNode")),// cluster singleton manager settings
name: "widgetmanager");
I'm trying to use Akka.Persistence with in-memory snapshot for the AtLeastOnceDeliveryReceiveActor. If everything is left with defaults, it works. The actor "stops" receiving any message, if I use the following serialization in my HOCON:
serializers {
wire = "Akka.Serialization.WireSerializer, Akka.Serialization.Wire"
}
serialization-bindings {
"System.Object" = wire
}
I also tried Hyperion, same issue. If I remove this configuration, it works .
Is this a bug or misconfiguration ?
OnCompleted
for an Akka.Stream but I did not figure out how to apply it to my scenario. The docs are rather limited about Akka.Stream to my feelings.
Task
completes was bad. The streaming process is not completed at that point in time yet. Will have to find out how to have a callback are message to myself send the stream completed.
Select
stage where you send the bytes to your actor and simply return Unit.Default
. As Sink
use Sink.Ignore
which provides a Task
which is completed once the stream has actually processed all elements
SelectAsnyc
+ actor.Ask
if you want backpressure
Hello everyone! I'm currently working on a clustered Akka.net application. While trying to catch some exceptions thrown in one microservice, aggregate them into a list, and send to another microservice I've run into the following error:
08/03/2017 17:31:00 [ERROR] [akka://TestHub/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FTestHub%4010.16.4.33%3A57197-2] "No parameterless constructor defined for this object."
System.MissingMethodException: No parameterless constructor defined for this object.
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at Hyperion.SerializerFactories.ExceptionSerializerFactory.<>c__DisplayClass9_0.<BuildSerializer>b__0(Stream stream, DeserializerSession session)
at Hyperion.ValueSerializers.ObjectSerializer.ReadValue(Stream stream, DeserializerSession session)
at Hyperion.SerializerFactories.EnumerableSerializerFactory.<>c__DisplayClass5_0.<BuildSerializer>b__1(Stream stream, DeserializerSession session)
at Hyperion.ValueSerializers.ObjectSerializer.ReadValue(Stream stream, DeserializerSession session)
at lambda_method(Closure , Stream , DeserializerSession )
at Hyperion.ValueSerializers.ObjectSerializer.ReadValue(Stream stream, DeserializerSession session)
at lambda_method(Closure , Stream , DeserializerSession )
at Hyperion.ValueSerializers.ObjectSerializer.ReadValue(Stream stream, DeserializerSession session)
at Hyperion.Serializer.Deserialize[T](Stream stream)
at Akka.Serialization.HyperionSerializer.FromBinary(Byte[] bytes, Type type)
at Akka.Serialization.Serialization.Deserialize(Byte[] bytes, Int32 serializerId, String manifest)
at Akka.Remote.MessageSerializer.Deserialize(ActorSystem system, SerializedMessage messageProtocol)
at Akka.Remote.DefaultMessageDispatcher.Dispatch(IInternalActorRef recipient, Address recipientAddress, SerializedMessage message, IActorRef senderOption)
at Akka.Remote.EndpointReader.<Reading>b__11_1(InboundPayload inbound)
at lambda_method(Closure , Object , Action`1 , Action`1 , Action`1 )
at Akka.Tools.MatchHandler.PartialHandlerArgumentsCapture`4.Handle(T value)
at Akka.Actor.ReceiveActor.ExecutePartialMessageHandler(Object message, PartialAction`1 partialAction)
at Akka.Actor.ReceiveActor.OnReceive(Object message)
at Akka.Actor.UntypedActor.Receive(Object message)
at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message)
at Akka.Actor.ActorCell.ReceiveMessage(Object message)
at Akka.Actor.ActorCell.Invoke(Envelope envelope)
--- End of stack trace from previous location where exception was thrown ---
at Akka.Actor.ActorCell.HandleFailed(Failed f)
at Akka.Actor.ActorCell.SysMsgInvokeAll(EarliestFirstSystemMessageList messages, Int32 currentState)
Both Exception and List<T> have parameterless constructors so I'm at a loss here. Does anybody know how to figure out which type "this object" is?