akkadotnet / akka.quartz.actor Goto Github PK
View Code? Open in Web Editor NEWQuartz scheduling actor
License: Apache License 2.0
Quartz scheduling actor
License: Apache License 2.0
Expected behavior
I should be able to use a custom serializer defined with SerializerWithStringManifest
or Serializer
when IncludeManifest = true
and have the appropriate type info passed into FromBinary
.
Actual behavior
If using a custom serializer defined with Serializer
when IncludeManifest = true
, the manifest type passed into FromBinary
is not correct.
If using a custom serializer defined with SerializerWithStringManifest
, the manifest type string provided in my custom serializer's Manifest
method is not passed into the manifest parameter of FromBinary
.
Additional context
I am using F# so fixing this so I can define a custom serializer to serialize/deserialize messages with a 3rd party library would be quite helpful.
When using a persistent JobStore (a database backing Quartz for example) the objects in the JobDataMap need to be serialized.
I came across an issue where the Quartz JobStore would not serialize the ActorPath and the message (unless it was a primitive type or string).
Hi there,
I'm using this framework to schedule timers.
Users can cancel these timers. It may be possible that multiple attempts are made to cancel a given timer.
The problem is that at least on the dev branch, when a job is not found, the only way to check if it the remove job fail was sent due to the timer already being cancelled is by performing a string comparison against
"job not found"
. This is problematic as this means that should this package be updated and the error string be changed, then code will assume failure for other reasons.
It would be nice to allow the user when creating jobs to add any time of trigger. Maybe splitting the job/trigger creation would be a good idea also?
I'm happy to look at this as I know quartz and have used it in other projects.
Cheers
Sean.
Null reference exception using constructor QuartzPersistentActor(IScheduler scheduler):
System.NullReferenceException: Object reference not set to an instance of an object.
at Akka.Quartz.Actor.QuartzPersistentActor.AddSystemToScheduler()
at Akka.Quartz.Actor.QuartzPersistentActor..ctor(IScheduler scheduler)
at AltitudeCloud.JobSchedulerService.Actors.ScheduleActor..ctor(ActorFactory actorFactory, ILog log, IScheduler scheduler)
parameter scheduler is not null, but because the _scheduler field is private in both QuartzPersistentActor and base class QuartzActor, and is not set in QuartzPersistentActor when the method AddSystemToScheduler is called it uses _scheduler which is obviously null.
This could be solved either by converting the _scheduler field to protected
in QuartzActor class (probably the best solution) or by setting this._scheduler = scheduler
in constructor QuartzPersistentActor(IScheduler scheduler).
Hi,
Would it be a good idea to convert the QuartzActor to a ReceiveActor?
Version Information
Akka 1.4.31
Akka.Quartz.Actor
1.4.31`
Describe the bug
When using Akka custom message serializer and QuartzPersistentActor
it fails to deserialize message from binary in QuartzPersistentJob.Execute
, as it searches for serializer for typeof(object)
which is Akka.Serialization.NewtonSoftJsonSerializer
by default. However, initially, the message was serialized with a custom serializer in QuartzPersistentJob.CreateBuilderWithData
.
I have custom serializers defined in Akka to serialize messages using protobuf
. I inherit my serializers from SerializerWithStringManifest
and use manifest
that is based on the message type. When doing
var message = sys.Serialization.FindSerializerForType(typeof(object)).FromBinary(messageBytes, typeof(object));
in QuartzPersistentJob.Execute
, it can't find proper serializer for type typeof(object)
and returns Akka.Serialization.NewtonSoftJsonSerializer
(default) which can't deserialize, because bytes
are not json
bytes, but protobuf
bytes.
I tried to implement a custom serializer to handle deserializaion of typeof(object)
, but there is no way to figure out which exact type the bytes
belong to, when the second argument type
is always object
type:
public class ObjectSerializer : Akka.Serialization.Serializer
{
// ....
public override object FromBinary(byte[] bytes, Type type)
{
// typeof(type) == typeof(object)
// how to figure out which class is encoded in bytes?
}
}
FromBinary
is called from here:
To Reproduce
Steps to reproduce the behavior:
Quartz
logs.QuartzPersistentActor
and schedule a job via it with a message that is serialized by serializer from 1.
.Expected behavior
Pass correct Type type
to FromBinary
when executing a job, not typeof(object)
. Or introduce any other solution that will fix the issue.
Users of Akka.Quartz.Actor
must be able to use any custom serializers.
Actual behavior
Serialized messages can't be deserialized back.
Environment
Windows 10, .NET 5
I use the version of quartz 1.3.1
I have a need to stop for a while the call on schedule and after a while to restore the work on schedule. Now I have a situation: If the trigger worked at least once after its deletion and creation of a new one, the new trigger is executed immediately after creation.
In what may be a problem, maybe it's the expected behavior
I haven't had a hugely detailed look at it, but upgrading to Quartz 3.0.3 (from 2.6.1) appears to be enough to break this actor. Will have a look if I get time but seems unlikely in the short term.
The Akka.Quartz.Actor
package, specified in the readme, is not found on nuget.org.
It would appears that:
CreateJobFail, JobEvent, and RemoveJobFail have been checked in with C# 6 readonly properties which don't compile.
Once I add a private set to these properties, the following tests fail unless I run them by themselves.
Allow the jobs to be persisted in the Quartz jobstore and then to work in a new instance of application with new incarnations of the actors. PR #14
Since Match() doesn't work anymore, I need to modify the code like this or it will throw "Could not load type 'Akka.PatternMatch' from assembly 'Akka, Version=1.5.0.0, Culture=neutral, PublicKeyToken=null'."
protected override bool Receive(object message)
{
if(message is CreateJob c)
{
CreateJobCommand(c);
return true;
}
if (message is RemoveJob r)
{
RemoveJobCommand(r);
return true;
}
return false;
//return message.Match().With<CreateJob>(CreateJobCommand).With<RemoveJob>(RemoveJobCommand).WasHandled;
}
and
protected override bool Receive(object message)
{
if (message is CreatePersistentJob c)
{
CreateJobCommand(c);
return true;
}
if (message is RemoveJob r)
{
RemoveJobCommand(r);
return true;
}
return false;
//return message.Match().With<CreatePersistentJob>(CreateJobCommand).With<RemoveJob>(RemoveJobCommand).WasHandled;
}
Hi,
Will there be a Nuget package release for use with Akka.1.2.0?
Version Information
Akka.NET 1.5.12
Akka.Quartz.Actor 1.5.1
Describe the bug
If scheduled message has a type that uses non-default serializer, it fails to be deserialized when it's triggered.
To Reproduce
Consider a message that implements maker interface IProtoBufSerializable (code in F#):
[<ProtoContract; CLIMutable; NoComparison>]
type Message =
{
[<ProtoMember(1)>]
Description: string
}
interface IProtoBufSerializable
Here is serialization configuratIon:
serializers {
hyperion = "Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion"
protobuf = "Sample.PersistentEvents+ProtobufSerializer, Sample"
}
serialization-bindings {
"System.Object" = hyperion
"Sample.PersistentEvents+IProtoBufSerializable, Sample" = protobuf
}
serialization-identifiers {
"Akka.Serialization.HyperionSerializer, Akka.Serialization.Hyperion" = -5
"Akka.Serialization.NewtonSoftJsonSerializer, Akka" = 1
"Sample.PersistentEvents+ProtobufSerializer, Sample" = 127
}
When scheduling a message, Akka.Quartz actor uses non-standard Protobuf serializer:
Serializer messageSerializer = system.Serialization.FindSerializerFor(message);
var serializedMessage = messageSerializer.ToBinary(message);
But when message is deserialized, Akka.Quartz actor uses serializer for object:
var message = sys.Serialization.FindSerializerForType(typeof(object)).FromBinary(messageBytes, typeof(object));
Deserialization encounters unexpected binary stream and fails with System.Runtime.Serialization.SerializationException ("Failed to deserialize instance of type System.Object. Stream didn't returned sufficient bytes")
Expected behavior
The same serializer should be used for both serialization and deserialization.
Actual behavior
Different serializers are chosen for serialization and deserialization, causing deserialization failure with SerializationException
Environment
Both Windows and Linux
it would be nice if we could allow the user to pass in an already initialized scheduler raas well as props. This would handle the situation where a schedule has already been created and added to a di container.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.