Skip to content

Commit 82d23e9

Browse files
committed
README.md first version
1 parent a4f3644 commit 82d23e9

File tree

1 file changed

+65
-9
lines changed

1 file changed

+65
-9
lines changed

README.md

Lines changed: 65 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,75 @@
11
## Apex Chainable
2-
TBD
2+
This library provides all the classes required to chain all kind of Async jobs.
3+
4+
## Installation
5+
<a href="https://githubsfdeploy.herokuapp.com?owner=scolladon&repo=apex-chainable">
6+
<img alt="Deploy to Salesforce"
7+
src="https://raw.githubusercontent.com/afawcett/githubsfdeploy/master/deploy.png">
8+
</a>
9+
310

411
## Usage
5-
TBD
12+
Create a class and extend the type of the chainable class you require.
13+
Your class can have its own constructors and its own attributes of course !
14+
Respect the interface contract and override the job method.
15+
You need to override the start method also for the chain_Batch and chain_ScheduleBatch class
16+
The job method will contains your business logic. It can access the private attributes of your class (and the protected ones of the base class).
17+
If you need some extra interface to make you're code work, it is up to you to add them (Database.Stateful, Database.AllowsCallouts, etc).
18+
You're ready to chain !
19+
You do not need to override another method except if you really know what you're doing
620

721
```apex
8-
/*TODO*/
22+
// Subclass Batch for example
23+
public class chain_Batch_EXAMPLE extends chain_Batch {
24+
public override Database.QueryLocator start(Database.BatchableContext bc) {
25+
return Database.getQueryLocator('select id from account limit 1');
26+
}
27+
28+
public chain_Batch_EXAMPLE(){
29+
super();
30+
}
31+
32+
protected override void job() {
33+
System.Debug('chain_Batch_EXAMPLE');
34+
}
35+
}
36+
37+
//Subclass Queue for example
38+
public class chain_Queue_EXAMPLE extends chain_Queue {
39+
40+
public chain_Queue_EXAMPLE(){
41+
super();
42+
}
43+
44+
protected override void job() {
45+
System.Debug('chain_Batch_EXAMPLE');
46+
}
47+
}
48+
49+
// Chain both and execute them
50+
public class Service {
51+
public static void doService() {
52+
chain_Chainable aChain = new chain_Batch_EXAMPLE();
53+
aChain.Add(new chain_Queue_EXAMPLE());
54+
55+
aChain.executeChain();
56+
}
57+
}
958
```
1059

1160
## Improvement
1261

13-
BatchIterable and ScheduleBatchIterable
62+
Implement sub class allowing to handle Batch and ScheduleBatch with iterable in addition of QueryLocator
63+
Allow to benefit from [this pilot](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_enhanced_future_overview.htm) for the chain_Future class
1464

15-
## Installation
16-
<a href="https://githubsfdeploy.herokuapp.com?owner=scolladon&repo=apex-chainable">
17-
<img alt="Deploy to Salesforce"
18-
src="https://raw.githubusercontent.com/afawcett/githubsfdeploy/master/deploy.png">
19-
</a>
65+
## Versioning
66+
67+
[SemVer](http://semver.org/) is used for versioning.
68+
69+
## Authors
70+
71+
* **Sebastien Colladon** - *Initial work* - [scolladon](https://github.com/scolladon)
72+
73+
## License
74+
75+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details

0 commit comments

Comments
 (0)