{"_id":"55ed86db2e66b621009941a6","category":{"_id":"55e94ebee5d0c623003ed86c","pages":["55e94ebfe5d0c623003ed86e","55ed7fdadf21af2b009e217d","55ed86db2e66b621009941a6","55ed879428d7c33700de00e1","55ed88392e66b621009941a9","55ed885cec4c3e3900b75611","55ed88ba2e66b621009941ab","55ed8caba872a80d00acff5d","55ed8ce82e66b621009941c3","560d5df697a0a32f006e9de9","566ff8f33a32d20d00c45b37","5670195e81801f0d00802e1c"],"version":"55e94ebee5d0c623003ed86b","__v":12,"project":"55e94ebde5d0c623003ed868","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-04T07:56:46.830Z","from_sync":false,"order":9999,"slug":"documentation","title":"Documentation"},"__v":5,"project":"55e94ebde5d0c623003ed868","version":{"_id":"55e94ebee5d0c623003ed86b","project":"55e94ebde5d0c623003ed868","__v":1,"createdAt":"2015-09-04T07:56:46.272Z","releaseDate":"2015-09-04T07:56:46.272Z","categories":["55e94ebee5d0c623003ed86c"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.3.0","version":"0.3.0"},"githubsync":"","user":"55e94db887e942230032e40d","updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-09-07T12:45:15.626Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"Majordodo main client API is HTTP/JSON based.\nOperations are:\n\n  * submit a single task\n  * submit multiple tasks\n  * begin a transaction\n  * commit a transaction\n  * rollback a transaction\n  * get tasks status\n  * create a CodePool\n  * delete a CodePool\n  * get CodePool status\n\nFor Java client it's better to use the official Java Client API, which is based on Apache Commons HttpComponents and Jackson Mapper (for JSON). It provides connection pooling and it is tested and maintained by the dev team.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Transactions\"\n}\n[/block]\nSubmission of tasks can be done inside the context of a transaction.\nOnly when the transaction gets committed then actually the tasks are scheduled for execution. Upon rollback tasks are discarded automatically.\n\nGiven the stateless nature of Http (even when using persistent/keep-alive connections) abandoned (uncommitted) transaction are automatically rolled back after a configurable period of inactivity.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Slots\"\n}\n[/block]\nIf a task is submitted within a slot then response of the submitTask (and submitTasks) request will not return a new taskid if the slot is already busy. When running inside a transaction the slot is locked immediately, and it's freed automatically on rollbacks.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Maven coordinates\"\n}\n[/block]\nMain  dependency for clients is majordodo-client\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<dependency>\\n    <groupId>majordodo</groupId>\\n    <artifactId>majordodo-client</artifactId>\\n    <version>your-majordodo-version</version>\\n</dependency>\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]\nIf you use dynamic code deployment you have to implement TaskExecutor an so you will need the majordodo-worker dependency\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<dependency>\\n    <groupId>majordodo</groupId>\\n    <artifactId>majordodo-worker</artifactId>\\n    <version>your-majordodo-version</version>\\n</dependency>\",\n      \"language\": \"text\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"client-api","type":"basic","title":"Client API"}
Majordodo main client API is HTTP/JSON based. Operations are: * submit a single task * submit multiple tasks * begin a transaction * commit a transaction * rollback a transaction * get tasks status * create a CodePool * delete a CodePool * get CodePool status For Java client it's better to use the official Java Client API, which is based on Apache Commons HttpComponents and Jackson Mapper (for JSON). It provides connection pooling and it is tested and maintained by the dev team. [block:api-header] { "type": "basic", "title": "Transactions" } [/block] Submission of tasks can be done inside the context of a transaction. Only when the transaction gets committed then actually the tasks are scheduled for execution. Upon rollback tasks are discarded automatically. Given the stateless nature of Http (even when using persistent/keep-alive connections) abandoned (uncommitted) transaction are automatically rolled back after a configurable period of inactivity. [block:api-header] { "type": "basic", "title": "Slots" } [/block] If a task is submitted within a slot then response of the submitTask (and submitTasks) request will not return a new taskid if the slot is already busy. When running inside a transaction the slot is locked immediately, and it's freed automatically on rollbacks. [block:api-header] { "type": "basic", "title": "Maven coordinates" } [/block] Main dependency for clients is majordodo-client [block:code] { "codes": [ { "code": "<dependency>\n <groupId>majordodo</groupId>\n <artifactId>majordodo-client</artifactId>\n <version>your-majordodo-version</version>\n</dependency>", "language": "text" } ] } [/block] If you use dynamic code deployment you have to implement TaskExecutor an so you will need the majordodo-worker dependency [block:code] { "codes": [ { "code": "<dependency>\n <groupId>majordodo</groupId>\n <artifactId>majordodo-worker</artifactId>\n <version>your-majordodo-version</version>\n</dependency>", "language": "text" } ] } [/block]