Open Kilda Java Documentation
AbstractVerificationCommand.java
Go to the documentation of this file.
1
/* Copyright 2018 Telstra Open Source
2
*
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
16
package
org.openkilda.floodlight.command.flow;
17
18
import
org
.
openkilda
.
floodlight
.
command
.
Command
;
19
import
org
.
openkilda
.
floodlight
.
command
.
CommandContext
;
20
import
org
.
openkilda
.
floodlight
.
kafka
.
KafkaMessageProducer
;
21
import
org
.
openkilda
.
messaging
.
Topic
;
22
import
org
.
openkilda
.
messaging
.
command
.
flow
.
UniFlowVerificationRequest
;
23
import
org
.
openkilda
.
messaging
.
info
.
InfoMessage
;
24
import
org
.
openkilda
.
messaging
.
info
.
flow
.
FlowVerificationErrorCode
;
25
import
org
.
openkilda
.
messaging
.
info
.
flow
.
UniFlowVerificationResponse
;
26
27
abstract
class
AbstractVerificationCommand
extends
Command
{
28
private
final
KafkaMessageProducer
kafkaProducer;
29
private
final
UniFlowVerificationRequest
verificationRequest;
30
31
AbstractVerificationCommand(
CommandContext
context,
UniFlowVerificationRequest
verificationRequest) {
32
super(context);
33
34
this.verificationRequest = verificationRequest;
35
kafkaProducer = getContext().
getModuleContext
().getServiceImpl(
KafkaMessageProducer
.class);
36
}
37
38
protected
void
sendResponse(
UniFlowVerificationResponse
response) {
39
InfoMessage
message =
new
InfoMessage
(response, System.currentTimeMillis(), getContext().
getCorrelationId
());
40
kafkaProducer.
postMessage
(
Topic
.
FLOW
, message);
41
}
42
43
protected
void
sendErrorResponse(
FlowVerificationErrorCode
errorCode) {
44
UniFlowVerificationResponse
response =
new
UniFlowVerificationResponse
(verificationRequest, errorCode);
45
sendResponse(response);
46
}
47
48
protected
UniFlowVerificationRequest
getVerificationRequest() {
49
return
verificationRequest;
50
}
51
}
org.openkilda.floodlight.command
Definition:
Command.java:16
org.openkilda.messaging
Definition:
BaseMessage.java:16
org.openkilda.messaging.info.InfoMessage
Definition:
InfoMessage.java:45
org
org.openkilda.messaging.info.flow.FlowVerificationErrorCode
Definition:
FlowVerificationErrorCode.java:18
org.openkilda.floodlight.kafka
Definition:
Consumer.java:16
org.openkilda.messaging.info.flow.UniFlowVerificationResponse
Definition:
UniFlowVerificationResponse.java:33
org.openkilda.messaging.command.flow.UniFlowVerificationRequest
Definition:
UniFlowVerificationRequest.java:33
org.openkilda.floodlight.command.CommandContext
Definition:
CommandContext.java:22
org.openkilda.floodlight
org.openkilda.messaging.Topic
Definition:
Topic.java:22
org.openkilda.floodlight.command.CommandContext.getModuleContext
FloodlightModuleContext getModuleContext()
Definition:
CommandContext.java:37
org.openkilda.floodlight.kafka.KafkaMessageProducer.postMessage
void postMessage(final String topic, final Message message)
Definition:
KafkaMessageProducer.java:90
org.openkilda.messaging.info.flow
Definition:
FlowCacheSyncResponse.java:16
org.openkilda
org.openkilda.floodlight.command.CommandContext.getCorrelationId
String getCorrelationId()
Definition:
CommandContext.java:45
org.openkilda.messaging.info
Definition:
CacheTimeTag.java:15
org.openkilda.floodlight.kafka.KafkaMessageProducer
Definition:
KafkaMessageProducer.java:36
org.openkilda.messaging.Topic.FLOW
static final String FLOW
Definition:
Topic.java:25
org.openkilda.messaging.command
Definition:
CommandData.java:16
org.openkilda.messaging.command.flow
Definition:
BaseFlow.java:16
org.openkilda.floodlight.command.Command
Definition:
Command.java:22
open-kilda-develop
services
src
floodlight-modules
src
main
java
org
openkilda
floodlight
command
flow
AbstractVerificationCommand.java
Generated by
1.8.14