summaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin/src/main/java/com/yahoo/vespa/http/server/FeedErrorMessage.java
blob: 45336ea911a5deb539507ff663f72801c17332a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.http.server;

import com.yahoo.document.DocumentId;
import com.yahoo.messagebus.Message;
import com.yahoo.text.Utf8String;

import java.util.Arrays;

public class FeedErrorMessage extends Message {

    private long sequenceId;

    public FeedErrorMessage(String operationId) {
        try {
            DocumentId id = new DocumentId(operationId);
            sequenceId = Arrays.hashCode(id.getGlobalId());
        } catch (Exception e) {
            sequenceId = 0;
        }
    }

    @Override
    public Utf8String getProtocol() {
        return new Utf8String("vespa-feed-handler-internal-bogus-protocol");
    }

    @Override
    public int getType() {
        return 1234;
    }

    @Override
    public boolean hasSequenceId() {
        return true;
    }

    @Override
    public long getSequenceId() {
        return sequenceId;
    }

}