@@ -44,13 +44,11 @@ public class AzureBlobStorageConsumer extends FailureTrackingAirbyteMessageConsu
44
44
private final Consumer <AirbyteMessage > outputRecordCollector ;
45
45
private final Map <AirbyteStreamNameNamespacePair , AzureBlobStorageWriter > streamNameAndNamespaceToWriters ;
46
46
47
- private AirbyteMessage lastStateMessage = null ;
48
-
49
47
public AzureBlobStorageConsumer (
50
- final AzureBlobStorageDestinationConfig azureBlobStorageDestinationConfig ,
51
- final ConfiguredAirbyteCatalog configuredCatalog ,
52
- final AzureBlobStorageWriterFactory writerFactory ,
53
- final Consumer <AirbyteMessage > outputRecordCollector ) {
48
+ final AzureBlobStorageDestinationConfig azureBlobStorageDestinationConfig ,
49
+ final ConfiguredAirbyteCatalog configuredCatalog ,
50
+ final AzureBlobStorageWriterFactory writerFactory ,
51
+ final Consumer <AirbyteMessage > outputRecordCollector ) {
54
52
this .azureBlobStorageDestinationConfig = azureBlobStorageDestinationConfig ;
55
53
this .configuredCatalog = configuredCatalog ;
56
54
this .writerFactory = writerFactory ;
@@ -93,8 +91,8 @@ protected void startTracked() throws Exception {
93
91
}
94
92
95
93
private void createContainers (final SpecializedBlobClientBuilder specializedBlobClientBuilder ,
96
- final AppendBlobClient appendBlobClient ,
97
- final ConfiguredAirbyteStream configuredStream ) {
94
+ final AppendBlobClient appendBlobClient ,
95
+ final ConfiguredAirbyteStream configuredStream ) {
98
96
// create container if absent (aka SQl Schema)
99
97
final BlobContainerClient containerClient = appendBlobClient .getContainerClient ();
100
98
if (!containerClient .exists ()) {
@@ -103,7 +101,7 @@ private void createContainers(final SpecializedBlobClientBuilder specializedBlob
103
101
if (DestinationSyncMode .OVERWRITE .equals (configuredStream .getDestinationSyncMode ())) {
104
102
LOGGER .info ("Sync mode is selected to OVERRIDE mode. New container will be automatically"
105
103
+ " created or all data would be overridden (if any) for stream:" + configuredStream
106
- .getStream ().getName ());
104
+ .getStream ().getName ());
107
105
var blobItemList = StreamSupport .stream (containerClient .listBlobs ().spliterator (), false )
108
106
.collect (Collectors .toList ());
109
107
blobItemList .forEach (blob -> {
@@ -121,7 +119,7 @@ private void createContainers(final SpecializedBlobClientBuilder specializedBlob
121
119
@ Override
122
120
protected void acceptTracked (final AirbyteMessage airbyteMessage ) throws Exception {
123
121
if (airbyteMessage .getType () == Type .STATE ) {
124
- this . lastStateMessage = airbyteMessage ;
122
+ outputRecordCollector . accept ( airbyteMessage ) ;
125
123
return ;
126
124
} else if (airbyteMessage .getType () != Type .RECORD ) {
127
125
return ;
@@ -154,10 +152,6 @@ protected void close(final boolean hasFailed) throws Exception {
154
152
for (final AzureBlobStorageWriter handler : streamNameAndNamespaceToWriters .values ()) {
155
153
handler .close (hasFailed );
156
154
}
157
-
158
- if (!hasFailed ) {
159
- outputRecordCollector .accept (lastStateMessage );
160
- }
161
155
}
162
156
163
157
private static String getOutputFilename (final Timestamp timestamp ) {
0 commit comments