All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Fixed some newer clippy issues
lapin
dependency updated to 2.1.0.
- Add explicit feature support for rustls/native-tls
v0.4.0-rcn.11 - 2021-10-07
- Fixed SemVer ordering.
v0.4.0-rc10 - 2021-08-30
- Fixed another bug with the
app!
andbeat!
related to issue #250.
v0.4.0-rc8 - 2021-08-05
-
⚠️ BREAKING CHANGE⚠️ The
RegularSchedule
in thebeat
module has been renamed toDeltaSchedule
to be more coherent with Python Celery terminology, where it is sometimes called timedelta. -
Tokio updated to 1.0.0.
-
The
Broker::configure_task_routes
producesBrokerError
instead ofCeleryError
. -
The
beat
macro now expects a list of tasks that is used to initialize the scheduler. -
Errors have been refactored:
- The
BadRoutingPattern
variant has been moved fromCeleryError
toBrokerError
; - The
CronScheduleError
has been replaced by aScheduleError
enum with aCronScheduleError
variant; - A
ScheduleError
variant has been added toBeatError
- A
BadRoutingPattern
error has been added.
- The
- 🚀🚀 Redis broker support 🚀🚀
- Added the
max_sleep_duration
property on theBeat
which can be used to ensure that the scheduler backend is called regularly (which may be necessary for custom backends). - Added a method
Beat::schedule_named_task
to add a scheduled task with a custom name. - Added a method
Broker::cancel
to cancel an existing consumer. - Changed
Ok
variant type of the the return type ofBroker::consume
. This is now a tuple that includes a unique consumer tag that can then be passed toBroker::cancel
to cancel the corresponding consumer. - Added a "coverage" job to GitHub Actions.
- Completed MessageBuilder struct
- Fixed a bug with
AMQPBroker::close()
that would result in an error withlapin
. - Fixed a bug with the
celery::app!
macro that caused it to fail to compile when the broker connection string was passed as a variable instead of an expression.
v0.4.0-rc5 - 2020-11-19
- Added the
CronSchedule
struct to support Celery's crontab schedules.
-
⚠️ BREAKING CHANGE⚠️ To improve the
app!
andbeat!
macros and accommodate customBroker
s andSchedulerBackend
s, we've had to make breaking changes to the way these macros are invoked.The biggest change is that the macros now return a future of
Result<Celery>
orResult<Beat>
. This means you must now call.await?
on the return value of the macro.The other change is that you must now supply the actual
Broker
type. Previously, you could write something likebroker = AMQP { "amqp://my-broker-url" }
, but now you have to write it likebroker = celery::broker::AMQPBroker { "amqp://my-broker-url" }
.For a concrete example of these changes, the old way looked like this:
#[tokio::main] async fn main() -> anyhow::Result<()> { let app = celery::app!( broker = AMQP { "amqp://my-broker-url" }, tasks = [add], task_routes = ["*" => "celery"], ); // ... Ok(()) }
Whereas now that will look like this:
#[tokio::main] async fn main() -> anyhow::Result<()> { let app = celery::app!( broker = celery::broker::AMQPBroker { "amqp://my-broker-url" }, tasks = [add], task_routes = ["*" => "celery"], ).await?; // ... Ok(()) }
-
Celery apps no longer need to have static lifetimes. To remove this constraint, we changed
Celery::consume
to take&Arc<Self>
instead of a static reference toself
. -
Now using
tokio-amqp
internally withlapin
. -
Drop explicit dependency on amq-protocol.
- Task ID now logged when a beat app sends a task.
- Fixes to docs. Added a "Build Docs" job to GitHub Actions.
- Fixed a Celery beat issue that caused a task to be dropped if its scheduled run was delayed
- Added a
MockBroker
for internal testing. - Added more tests to the
app
module. - Added a
prelude
module. - Added support for YAML, MsgPack, and Pickle content types, behind the
extra_content_types
feature flag.
- Improved
TaskResultExt
. Now takes aFnOnce() -> Context
instead of&str
.
- Ensure a
Signature
inherits defaultTaskOptions
from the correspondingTask
andCelery
orBeat
app. - Cleaned up remaining uses of
.unwrap()
in the library. - Options returned with
Task::options()
now have the current values, where app-level values are overridden by task-level values.
- Added a
.display_pretty()
method on theCelery
struct that prints out a cool ASCII logo with some useful information about the app. - Added an
AsyncResult
struct that acts as a handler for task results. - Added
Task::retry_with_countdown
andTask::retry_with_eta
trait methods so that tasks can manually trigger a retry.
- Fields of the
Signature
struct made private to avoid confusion around which fields ofTaskOptions
apply to aSignature
. Celery::send_task
now returns anAsyncResult
instead of aString
for theOk
variant.- Renamed
DummyBackend
toLocalSchedulerBackend
. - Switched to
thiserror
for the error module instead of the deprecatedfailure
crate.
- Fixed bug where
hard_time_limit
was ignored by worker if only specified at the app or task level.
- Added a
reconnect
method on theBroker
.
Celery
andBeat
apps will automatically try to reconnect the broker when the connection fails.
- Added a
hard_time_limit
task option for compatability with Python.
- The
timeout
task option was renamed totime_limit
to be more consistent with the Python API.
- Compiles on Windows
beat
module with basic support for scheduling tasks.beat
macro to create aBeat
app.
lapin
dependency updated to 1.0.BrokerError
variants trimmed and simplified.- The error handler closure passed to
Broker::consume
now takes aBrokerError
as an argument. - Improved error messages.
Message::headers::origin
field fixed. Before it included quotes around the hostname.
Request::hostname
field now populated by theCelery
app consuming the task.
- Sending a task
with_timeout
will only set thesoft_time_limit
so that the behavior is the same for Python consumers.
- Tasks must explicitly return a
TaskResult<T>
now.
- A
retry_for_unexpected
task configuration option. By default this istrue
(so the default behavior is unchanged). But if set tofalse
, tasks that raisedTaskError::UnexpectedError
won't be retried.
CeleryBuilder::task_route
now infallible. Error could be raised during thebuild
phase instead.Celery::consume_from
will returnErr(CeleryError::NoQueueToConsume)
if the slice of queues is empty.
Celery::consume_from
now takes multiple queues instead of just a single queue.- Retry ETA method moved from tracer to task so that it can be customized.
TaskError
variants restricted to onlyExpectedError
,UnexpectedError
, andTimeoutError
. TheRetry
andExpirationError
variants moved to a new (non-public) error type:TracerError
.
on_failure
andon_success
options totask
attribute macro.
- Removed
task_id
andparams
arguments toon_failure
andon_success
callbacks, since those can be gotten from the request object.
- A
Signature
struct with includes task execution options (previously the fields inTaskSendOptions
). - A
bind
argument to thetask
macro. Whenbind = true
is given, the task will be run as an instance method. - A
Request
struct.
protocol::TryIntoMessage
trait renamed toTryCreateMessage
and the one trait functiontry_into_message
renamed totry_create_message
to better reflect the fact that the trait function does not consumeself
.- Task parameters are now separated from task struct.
- Task callback methods
on_failure
andon_success
are now instance methods. Celery::send_task
now takes aSignature
instead of aTask
.- When tasks are defined through the
task
macro by annotating a function, that function needs to be explicitly marked async for the function to use async / await syntax.
TaskContext
struct.TaskSendOptions
.Celery::send_task_with
.
- Uses of
std::sync::Mutex
andstd::sync::RwLock
changed to their async-aware equivalents fromtokio
. - The
Celery::register_task
method is now an async function due to the above. - Fixed bug where tasks with a future ETA were acked before they were due, resulting in such tasks being lost if the worker was shutdown before they were due.
- The
SyncError
variants have been removed.
Celery::consume_from
now only accepts a single queue (once again) since there was a critical bug when we allowed consuming from multiple queues.
- Several error enums:
CeleryError
,TaskError
,BrokerError
,ProtocolError
. TaskResultExt
for easily converting the error type in aResult
to aTaskError
variant.
- The
error
module. - The structure of the public API is now more compact. We expose a few more modules, including
broker
,task
, anderror
instead of exporting all of the public elements from the crate root. - The
app
macro (previouslycelery_app
) no longer takes an actual broker type (likeAMQPBroker
) for thebroker
parameter. Instead you can just use the literal tokenAMQP
. This means one less import for the user.
- The
Error
type. - The
celery_app
macro has been renamed to justapp
. - The
ResultExt
re-export.