Coder Social home page Coder Social logo

akka.quartz.actor's People

Contributors

aaronontheweb avatar alexpantyukhin avatar alexvaluyskiy avatar arkatufus avatar danthar avatar dependabot-preview[bot] avatar dependabot[bot] avatar eaba avatar irvindominin avatar jaspritbola avatar maxim-s avatar mrjin-syd avatar ncthbrt avatar object avatar sean-gilliam avatar seanfarrow avatar smoksnes avatar wimtnick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

akka.quartz.actor's Issues

Add support for preserving type info throughout serialization/deserialization process

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.

Strong typing of Job Not Found

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.

Allow the user to specify any type of trigger

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)

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).

Error deserializing messages when using custom Akka serializers

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:
image

To Reproduce
Steps to reproduce the behavior:

  1. Register a custom Akka binary serializer that is not JSON serializer.
  2. Enable Quartz logs.
  3. Create QuartzPersistentActor and schedule a job via it with a message that is serialized by serializer from 1..
  4. When job is triggered you shoud see an error like this
    image

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

Unexpected execution after recreate trigger object

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

Update to Quartz v3

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.

Compilation issues and failing tests

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.

  1. QuartzActor_Should_Create_Job
  2. QuartzPersistentActor_Should_Remove_Job

Use this lib with Akka.Net 1.5

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;
        }

Incorrect choice of serializer causes SerializationException

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

Allow a user to use an already initialized scheduler

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.