Skip to content

Commit

Permalink
remove calls to deprecated Adaptable#getHeaders
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Fendt <Florian.Fendt@bosch.io>
  • Loading branch information
ffendt committed Sep 17, 2020
1 parent d3cc6ca commit c318cc1
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.util.Optional;

import org.eclipse.ditto.json.JsonValue;
import org.eclipse.ditto.model.base.headers.DittoHeaders;
import org.eclipse.ditto.protocoladapter.Adaptable;
import org.eclipse.ditto.protocoladapter.TopicPath;
import org.eclipse.ditto.signals.events.thingsearch.SubscriptionEvent;
Expand Down Expand Up @@ -82,11 +81,16 @@ public Optional<Classification> classify(final Adaptable message) {
return Optional.of(Classification.StreamingType.LIVE_EVENT);
case MESSAGES:
return Optional.of(Classification.StreamingType.LIVE_MESSAGE);
default:
return Optional.empty();
}
case TWIN:
if (topicPath.getCriterion() == TopicPath.Criterion.EVENTS) {
return Optional.of(Classification.StreamingType.TWIN_EVENT);
}
break;
default:
return Optional.empty();
}
}
return Optional.empty();
Expand Down Expand Up @@ -115,8 +119,8 @@ public Optional<Classification> classify(final Adaptable message) {
private static final class Instances {

private static final Classifier<Adaptable> CORRELATION_ID_CLASSIFIER = adaptable ->
adaptable.getHeaders()
.flatMap(DittoHeaders::getCorrelationId)
adaptable.getDittoHeaders()
.getCorrelationId()
.map(Classification::forCorrelationId);

private static final Classifier<Adaptable> STREAMING_TYPE_CLASSIFIER = new StreamingTypeClassifier();
Expand Down

0 comments on commit c318cc1

Please sign in to comment.