|
41 | 41 | import com.datastax.oss.driver.internal.core.protocol.BytesToSegmentDecoder; |
42 | 42 | import com.datastax.oss.driver.internal.core.protocol.FrameToSegmentEncoder; |
43 | 43 | import com.datastax.oss.driver.internal.core.protocol.LwtInfo; |
| 44 | +import com.datastax.oss.driver.internal.core.protocol.MetadataIdInfo; |
44 | 45 | import com.datastax.oss.driver.internal.core.protocol.SegmentToBytesEncoder; |
45 | 46 | import com.datastax.oss.driver.internal.core.protocol.SegmentToFrameDecoder; |
46 | 47 | import com.datastax.oss.driver.internal.core.protocol.ShardingInfo; |
@@ -98,6 +99,7 @@ class ProtocolInitHandler extends ConnectInitHandler { |
98 | 99 | private final boolean querySupportedOptions; |
99 | 100 | private LwtInfo lwtInfo; |
100 | 101 | private TabletInfo tabletInfo; |
| 102 | + private MetadataIdInfo metadataIdInfo; |
101 | 103 |
|
102 | 104 | /** |
103 | 105 | * @param querySupportedOptions whether to send OPTIONS as the first message, to request which |
@@ -198,6 +200,9 @@ Message getRequest() { |
198 | 200 | if (tabletInfo != null && tabletInfo.isEnabled()) { |
199 | 201 | TabletInfo.addOption(startupOptions); |
200 | 202 | } |
| 203 | + if (metadataIdInfo != null && metadataIdInfo.isEnabled()) { |
| 204 | + MetadataIdInfo.addOption(startupOptions); |
| 205 | + } |
201 | 206 | return request = new Startup(startupOptions); |
202 | 207 | case GET_CLUSTER_NAME: |
203 | 208 | return request = CLUSTER_NAME_QUERY; |
@@ -227,17 +232,20 @@ void onResponse(Message response) { |
227 | 232 | ProtocolUtils.opcodeString(response.opcode)); |
228 | 233 | try { |
229 | 234 | if (step == Step.OPTIONS && response instanceof Supported) { |
230 | | - channel.attr(DriverChannel.OPTIONS_KEY).set(((Supported) response).options); |
231 | | - Supported res = (Supported) response; |
232 | | - ConnectionShardingInfo shardingInfo = ShardingInfo.parseShardingInfo(res.options); |
| 235 | + Supported supported = (Supported) response; |
| 236 | + channel.attr(DriverChannel.OPTIONS_KEY).set(supported.options); |
| 237 | + ConnectionShardingInfo shardingInfo = ShardingInfo.parseShardingInfo(supported.options); |
233 | 238 | if (shardingInfo != null) { |
234 | 239 | channel.attr(DriverChannel.SHARDING_INFO_KEY).set(shardingInfo); |
235 | 240 | } |
236 | | - lwtInfo = LwtInfo.parseLwtInfo(res.options); |
| 241 | + lwtInfo = LwtInfo.parseLwtInfo(supported.options); |
237 | 242 | if (lwtInfo != null) { |
238 | 243 | channel.attr(LWT_INFO_KEY).set(lwtInfo); |
239 | 244 | } |
240 | | - tabletInfo = TabletInfo.parseTabletInfo(res.options); |
| 245 | + tabletInfo = TabletInfo.parseTabletInfo(supported.options); |
| 246 | + metadataIdInfo = |
| 247 | + MetadataIdInfo.parseMetadataId( |
| 248 | + supported.options); // TODO: Check if setting channel attribute is needed |
241 | 249 | step = Step.STARTUP; |
242 | 250 | send(); |
243 | 251 | } else if (step == Step.STARTUP && response instanceof Ready) { |
|
0 commit comments