Skip to content

Package: ServiceEventMarshaler

ServiceEventMarshaler

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2017, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.commons.event;
14:
15: import org.eclipse.kapua.KapuaException;
16: import org.eclipse.kapua.event.ServiceEvent;
17:
18: /**
19: * Event bus marshaler. It allows custom marshaling/unmarshaling of the service bus event object.
20: *
21: * @since 1.0
22: */
23: public interface ServiceEventMarshaler {
24:
25: String CONTENT_TYPE_KEY = "ContentType";
26:
27: /**
28: * Return the encoded content type
29: *
30: * @return
31: */
32: String getContentType();
33:
34: /**
35: * Unmarshal the message received from the bus
36: *
37: * @param message
38: * @return
39: * @throws KapuaException
40: */
41: ServiceEvent unmarshal(String message) throws KapuaException;
42:
43: /**
44: * Marshal the message to the service event bus
45: *
46: * @param kapuaEvent
47: * @throws KapuaException
48: */
49: String marshal(ServiceEvent kapuaEvent) throws KapuaException;
50:
51: }