{"id":26804810,"url":"https://github.com/throughnothing/sque","last_synced_at":"2025-03-29T22:27:14.234Z","repository":{"id":2677441,"uuid":"3669530","full_name":"throughnothing/Sque","owner":"throughnothing","description":"Background job processing based on Resque, using Stomp","archived":false,"fork":false,"pushed_at":"2014-07-21T17:02:55.000Z","size":368,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-04-14T01:26:37.664Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://metacpan.org/release/Sque/","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/throughnothing.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-09T10:14:37.000Z","updated_at":"2014-09-09T01:16:04.000Z","dependencies_parsed_at":"2022-08-29T12:40:55.979Z","dependency_job_id":null,"html_url":"https://github.com/throughnothing/Sque","commit_stats":null,"previous_names":[],"tags_count":11,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/throughnothing%2FSque","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/throughnothing%2FSque/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/throughnothing%2FSque/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/throughnothing%2FSque/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/throughnothing","download_url":"https://codeload.github.com/throughnothing/Sque/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246252563,"owners_count":20747768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-29T22:27:13.818Z","updated_at":"2025-03-29T22:27:14.224Z","avatar_url":"https://github.com/throughnothing.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nSque - Background job processing based on Resque, using Stomp\n\n# VERSION\n\nversion 0.010\n\n# SYNOPSIS\n\nFirst you create a Sque instance where you configure the [Stomp](https://metacpan.org/pod/Stomp)\nbackend and then you can start sending jobs to be done by workers:\n\n    use Sque;\n\n    my $s = Sque-\u003enew( stomp =\u003e '127.0.0.1:61613' );\n    # Or, for failover\n    $s = Sque-\u003enew( stomp =\u003e [ '127.0.0.1:61613', '127.0.0.2:61613' ] );\n\n    $s-\u003epush( my_queue =\u003e {\n        class =\u003e 'My::Task',\n        args =\u003e [ 'Hello world!' ]\n    });\n\nYou can also send by just using:\n\n    $s-\u003epush({\n        class =\u003e 'My::Task',\n        args =\u003e [ 'Hello world!' ]\n    });\n\nIn this case, the queue will be set automatically automatically to the\njob class name with colons removed, which in this\ncase would be 'MyTask'.\n\nYou can set custom `STOMP` headers by passing them in as follows:\n\n    $s-\u003epush( my_queue =\u003e {\n        class =\u003e 'My::Task',\n        args =\u003e [ 'Hello world!' ],\n        headers =\u003e { header1 =\u003e 'val1', header2 =\u003e 'val2' }\n    });\n\nAdditionally, the [sque](https://metacpan.org/pod/sque) command-line tool can be used to send messages:\n\n    $ sque send -h 127.0.0.1 -p 61613 -c My::Task 'Hello world!'\n\nBackground jobs can be any perl module that implement a perform() function.\nThe [Sque::Job](https://metacpan.org/pod/Sque::Job) object is passed as the only argument to this function:\n\n    package My::Task;\n    use strict;\n    use 5.10.0;\n\n    sub perform {\n        my ( $job ) = @_;\n        say $job-\u003eargs-\u003e[0];\n    }\n\n    1;\n\nBackground jobs can also be OO.  The perform function will still be called\nwith the [Sque::Job](https://metacpan.org/pod/Sque::Job) object as the only argument:\n\n    package My::Task;\n    use strict;\n    use 5.10.0;\n    use Moose;\n\n    with 'Role::Awesome';\n\n    has attr =\u003e ( is =\u003e 'ro', default =\u003e 'Where am I?' );\n\n    sub perform {\n        my ( $self, $job ) = @_;\n        say $self-\u003eattr;\n        say $job-\u003eargs-\u003e[0];\n    }\n\n    1;\n\nFinally, you run your jobs by instancing a [Sque::Worker](https://metacpan.org/pod/Sque::Worker) and telling it\nto listen to one or more queues:\n\n    use Sque;\n\n    my $w = Sque-\u003enew( stomp =\u003e '127.0.0.1:61613' )-\u003eworker;\n    $w-\u003eadd_queues('my_queue');\n    $w-\u003ework;\n\nOr you can simply use the [sque](https://metacpan.org/pod/sque) command-line tool which uses [App::Sque](https://metacpan.org/pod/App::Sque)\nlike so:\n\n    $ sque work --host 127.0.0.1 --port 61613 --workers 5 --lib ./lib --lib ./lib2 --queues Queue1,Queue2,Queue3\n\n# DESCRIPTION\n\nThis is a copy of [resque-perl](https://github.com/diegok/resque-perl)\nby [Diego Kuperman](https://github.com/diegok) simplified a little bit\n(for better or worse) and made to work with any stomp server rather than Redis.\n\n# ATTRIBUTES\n\n## stomp\n\nA Stomp Client on this sque instance.\n\n## namespace\n\nNamespace for queues, default is 'sque'\n\n## worker\n\nA [Sque::Worker](https://metacpan.org/pod/Sque::Worker) on this sque instance.\n\n# METHODS\n\n## push\n\nPushes a job onto a queue. Queue name should be a string and the\nitem should be a [Sque::Job](https://metacpan.org/pod/Sque::Job) object or a hashref containing:\nclass - The String name of the job class to run.\nargs - Any arrayref of arguments to pass the job.\n\nExample:\n\n    $sque-\u003epush( archive =\u003e { class =\u003e 'Archive', args =\u003e [ 35, 'tar' ] } )\n\n## pop\n\nPops a job off a queue. Queue name should be a string.\nReturns a l\u003cSque::Job\u003e object.\n\n## key\n\nConcatenate `$self-`namespace\u003e with the received array of names\nto build a redis key name for this sque instance.\n\n## new\\_job\n\nBuild a [Sque::Job](https://metacpan.org/pod/Sque::Job) object on this system for the given\nhashref(see [Sque::Job](https://metacpan.org/pod/Sque::Job)) or string(payload for object).\n\n# ATTRIBUTES\n\n# HELPER METHODS\n\n# TODO\n\n- Make App::Sque that will let you run sque and just pass it the\nstomp server/port, queue list, lib directories (if needed), and\nnumber of workers.\n- More (real) tests.\n\n# AUTHOR\n\nWilliam Wolf \u003cthroughnothing@gmail.com\u003e\n\n# COPYRIGHT AND LICENSE\n\n\n\nWilliam Wolf has dedicated the work to the Commons by waiving all of his\nor her rights to the work worldwide under copyright law and all related or\nneighboring legal rights he or she had in the work, to the extent allowable by\nlaw.\n\nWorks under CC0 do not require attribution. When citing the work, you should\nnot imply endorsement by the author.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthroughnothing%2Fsque","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthroughnothing%2Fsque","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthroughnothing%2Fsque/lists"}