Skip to content

akreuzer/akkastream-azure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moved into alpakka.


akkazure

Build Status

akkazure is an Akka Stream connector for the Azure Queue Storage.

Example usage

Init Azure Storage API

import com.microsoft.azure.storage._
import com.microsoft.azure.storage.queue._
val storageConnectionString = "DefaultEndpointsProtocol=http;AccountName=<YourAccountName>;AccountKey=<YourKey>"
val storageAccount = CloudStorageAccount.parse(storageConnectionString)
val queueClient = storageAccount.createCloudQueueClient
val queue = queueClient.getQueueReference("myQueue")

For more details, see Microsoft Azure Storage Docs.

Queuing a message

import one.aleph.akkzure.queue._
import one.aleph.akkzure.queue.scaladsl._

// Create an example message
val message = new CloudQueueMessage("Hello Azure")

Source.single(message).runWith(AzureQueueSink(queue)

Processing and deleting messages

AzureQueueSource(queue).take(10)
.map({ msg: CloudQueueMessage =>  
  println(msg.getMessageContentAsString) // Print the messages content
  msg                                    // Return message to the flow for deletion
}).runWith(AzureQueueDeleteSink(queue))

About

Akka Stream connector for Azure Storage Queue

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published