The Files component is an abstraction of persistent queues with a default implementation using AWS SQS. This also provides a much simplified API while making the underlying implementation swappable.
| Section | Component | Description |
| 1 | Status | Current status of this component |
| 2 | Install | Installation instructions and references to sources |
| 3 | Requires | Lists all the Slate Kit and third-party dependencies |
| 4 | Import | Packages to import |
| 5 | Setup | Set up of credentials, and configuration |
| 6 | Usage | Usage and examples |
This component is currently stable. However it is currently using the AWS 1.0 sdk that is synchonous. A future version will involve using AWS 2.0 sdk that is Async and incorporate Coroutines.
Back to top
repositories {
// other repositories
maven { url "http://dl.bintray.com/codehelixinc/slatekit" }
}
dependencies {
// other dependencies ...
compile 'com.slatekit:slatekit-cloud:1.0.0'
}| package | slatekit.cloud |
| jar | slatekit.cloud.jar |
| git | slatekit/src/lib/kotlin/slatekit-cloud |
| docs | Files |
| uses | slatekit.results, slatekit.core, slatekit.cloud |
| license | Apache 2.0 |
| example | Example_Files.kt |
This component uses the following other Slate Kit and/or third-party components.
| Component | Description |
| Results | To model successes and failures with optional status codes |
| Utils | Common utilities for both android + server |
import slatekit.cloud.aws.AwsCloudQueue
import slatekit.common.queues.QueueStringConverter
val converter = QueueStringConverter()
// Not storing any key/secret in source code for security purposes
// Setup 1: Use the default aws config file in "{user_dir}/.aws/credentials"
val queue1 = AwsCloudQueue<String>("app1-queue-1", "queue1", converter)
// Setup 2: Use the type safe config in "{user_id}/myapp/conf/queue.conf"
// Reads from the section "sqs" by default
val queue2 = AwsCloudQueue<String>("app1-queue-1", "queue1", converter,"user://myapp/conf/queue.conf")
// Setup 3: Use the type safe config in "{user_id}/myapp/conf/queue.conf"
// Reads from the section supplied "sqs-3" ( if you have multiple sqs configurations )
val queue3 = AwsCloudQueue<String>("app1-queue-1", "queue1", converter, "user://myapp/conf/queue.conf", "sqs-1")
// Use case 1: init()
queue2.init()
// Use case 2: send 1 message
queue2.send("test 1")
// Use case 3: send multiple messages
queue2.send("test 2")
// Use case 4: send message with tags
queue2.send("user=kishore", tagName="type", tagValue="reg")
// Use case 5: receive 1 message
val item1 = queue2.next()
println(item1?.getValue())
println(item1?.getTag("type"))
// Use case 6: recieve 2 messages
val items = queue2.next(2)
// Use case 7: delete a message
queue2.complete(item1)
// Use case 8: delete many
queue2.completeAll(items)
// Use case 9: abandon a message
queue2.abandon(queue2.next())
// Use case 10: get count ( approximation )
val count = queue2.count()
println(count)