Search in sources :

Example 31 with Message

use of org.apache.camel.Message in project camel by apache.

the class RouterProducer method doDelete.

private void doDelete(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(NeutronConstants.ROUTER_ID, String.class), String.class);
    ObjectHelper.notEmpty(id, "Router ID");
    final ActionResponse response = os.networking().router().delete(id);
    checkFailure(response, msg, "Delete router with ID " + id);
}
Also used : Message(org.apache.camel.Message) ActionResponse(org.openstack4j.model.common.ActionResponse)

Example 32 with Message

use of org.apache.camel.Message in project camel by apache.

the class RouterProducer method doUpdate.

private void doUpdate(Exchange exchange) {
    final Message msg = exchange.getIn();
    final Router router = messageToRouter(msg);
    final Router updatedRouter = os.networking().router().update(router);
    msg.setBody(updatedRouter);
}
Also used : Message(org.apache.camel.Message) Router(org.openstack4j.model.network.Router)

Example 33 with Message

use of org.apache.camel.Message in project camel by apache.

the class SnapshotProducer method doCreate.

private void doCreate(Exchange exchange) {
    final Message msg = exchange.getIn();
    final VolumeSnapshot in = messageToSnapshot(msg);
    final VolumeSnapshot out = os.blockStorage().snapshots().create(in);
    msg.setBody(out);
}
Also used : Message(org.apache.camel.Message) VolumeSnapshot(org.openstack4j.model.storage.block.VolumeSnapshot)

Example 34 with Message

use of org.apache.camel.Message in project camel by apache.

the class SnapshotProducer method doGet.

private void doGet(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(CinderConstants.SNAPSHOT_ID, String.class), String.class);
    ObjectHelper.notEmpty(id, "Snapshot ID");
    final VolumeSnapshot out = os.blockStorage().snapshots().get(id);
    msg.setBody(out);
}
Also used : Message(org.apache.camel.Message) VolumeSnapshot(org.openstack4j.model.storage.block.VolumeSnapshot)

Example 35 with Message

use of org.apache.camel.Message in project camel by apache.

the class VolumeProducer method doGet.

private void doGet(Exchange exchange) {
    final Message msg = exchange.getIn();
    final String id = msg.getHeader(OpenstackConstants.ID, msg.getHeader(CinderConstants.VOLUME_ID, String.class), String.class);
    ObjectHelper.notEmpty(id, "Volume ID");
    final Volume out = os.blockStorage().volumes().get(id);
    msg.setBody(out);
}
Also used : Message(org.apache.camel.Message) Volume(org.openstack4j.model.storage.block.Volume)

Aggregations

Message (org.apache.camel.Message)810 Exchange (org.apache.camel.Exchange)379 Test (org.junit.Test)262 Processor (org.apache.camel.Processor)120 MockEndpoint (org.apache.camel.component.mock.MockEndpoint)109 DefaultMessage (org.apache.camel.impl.DefaultMessage)67 DefaultExchange (org.apache.camel.impl.DefaultExchange)50 Endpoint (org.apache.camel.Endpoint)46 HashMap (java.util.HashMap)41 InputStream (java.io.InputStream)39 Response (javax.ws.rs.core.Response)38 ArrayList (java.util.ArrayList)33 RouteBuilder (org.apache.camel.builder.RouteBuilder)33 Map (java.util.Map)27 Producer (org.apache.camel.Producer)27 Customer (org.apache.camel.component.cxf.jaxrs.testbean.Customer)25 ActionResponse (org.openstack4j.model.common.ActionResponse)25 IOException (java.io.IOException)24 List (java.util.List)23 CamelContext (org.apache.camel.CamelContext)23