use of org.talend.components.azurestorage.queue.tazurestoragequeueoutput.TAzureStorageQueueOutputProperties in project components by Talend.
the class AzureStorageQueueOutputWriterTestIT method testWriteTTLMessage.
@Test
public void testWriteTTLMessage() throws Throwable {
queue.clear();
//
TAzureStorageQueueOutputProperties properties = new TAzureStorageQueueOutputProperties("tests");
properties = (TAzureStorageQueueOutputProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) properties);
properties.setupProperties();
properties.queueName.setValue(TEST_QUEUE_NAME);
properties.timeToLiveInSeconds.setValue(5);
Writer<?> writer = createWriter(properties);
writer.open("test-uid");
for (String m : messages) {
IndexedRecord entity = new GenericData.Record(properties.schema.schema.getValue());
entity.put(0, m + "TTL");
writer.write(entity);
}
writer.close();
int msgCount = 0;
for (CloudQueueMessage msg : queue.retrieveMessages(30)) {
msgCount++;
assertNotNull(msg.getMessageContentAsString());
assertTrue(msg.getMessageContentAsString().indexOf("TTL") > 0);
}
assertEquals(3, msgCount);
Thread.sleep(5000);
msgCount = 0;
for (CloudQueueMessage msg : queue.retrieveMessages(30)) {
msgCount++;
assertNotNull(msg.getMessageContentAsString());
}
assertEquals(0, msgCount);
}
use of org.talend.components.azurestorage.queue.tazurestoragequeueoutput.TAzureStorageQueueOutputProperties in project components by Talend.
the class AzureStorageQueueOutputWriterTestIT method testWriteDelayedMessage.
@Test
public void testWriteDelayedMessage() throws Throwable {
queue.clear();
//
TAzureStorageQueueOutputProperties properties = new TAzureStorageQueueOutputProperties("tests");
properties = (TAzureStorageQueueOutputProperties) setupConnectionProperties((AzureStorageProvideConnectionProperties) properties);
properties.setupProperties();
properties.queueName.setValue(TEST_QUEUE_NAME);
properties.initialVisibilityDelayInSeconds.setValue(5);
Writer<?> writer = createWriter(properties);
writer.open("test-uid");
for (String m : messages) {
IndexedRecord entity = new GenericData.Record(properties.schema.schema.getValue());
entity.put(0, m + "DLY");
writer.write(entity);
}
writer.close();
int msgCount = 0;
for (CloudQueueMessage msg : queue.retrieveMessages(30)) {
// we shoud not be here ...
msgCount++;
assertNotNull(msg.getMessageContentAsString());
assertTrue(msg.getMessageContentAsString().indexOf("DLY") > 0);
}
assertEquals(0, msgCount);
Thread.sleep(5000);
msgCount = 0;
for (CloudQueueMessage msg : queue.retrieveMessages(30)) {
msgCount++;
assertNotNull(msg.getMessageContentAsString());
assertTrue(msg.getMessageContentAsString().indexOf("DLY") > 0);
}
assertEquals(3, msgCount);
queue.downloadAttributes();
assertEquals(3, queue.getApproximateMessageCount());
}
Aggregations