Package com.streamreduce.core.model.dto

Examples of com.streamreduce.core.model.dto.OutboundConfigurationWithPayloadDTO


    @Override
    public void process(Exchange exchange) throws Exception {
        try {

            String dtoAsString = exchange.getIn().getBody(String.class);
            OutboundConfigurationWithPayloadDTO dto = objectMapper.readValue(dtoAsString,
                    OutboundConfigurationWithPayloadDTO.class);
            OutboundConfiguration outboundConfiguration =
                    createOutboundConfigurationFromDto(dto.getOutboundConfiguration());
            OutboundClient outboundClient =
                    outboundClientFactory.createOutboundClientForOutboundConfiguration(outboundConfiguration);

            if (dto.getDataType() == OutboundDataType.RAW) {
                outboundClient.putRawMessage(JSONObject.fromObject(dto.getPayload()));
            } else if (dto.getDataType() == OutboundDataType.PROCESSED) {
                SobaMessageResponseDTO responseDTO =
                        objectMapper.readValue(dto.getPayload(), SobaMessageResponseDTO.class);
                outboundClient.putProcessedMessage(responseDTO);
            } else if (dto.getDataType() == OutboundDataType.INSIGHT) {
                SobaMessageResponseDTO responseDTO =
                        objectMapper.readValue(dto.getPayload(), SobaMessageResponseDTO.class);
                outboundClient.putInsightMessage(responseDTO);
            } else {
                throw new OutboundStorageException("The received OutboundConfigurationWithPayloadDTO does not " +
                        "specify a valid dataType.  Was " + dto.getDataType() +
                        " but was expecting one of [RAW, PROCESSED, or Insight]");
            }
        } catch (Exception e) {
            logger.error("Unable to send payload outbound", e);
        }
View Full Code Here


        return numberOfMessagesRoutedOutbound;
    }

    void routePayloadOutbound(OutboundConfiguration outboundConfiguration, String payload,
                              OutboundDataType dataTypeForPayload) throws IOException {
        OutboundConfigurationWithPayloadDTO dto = new OutboundConfigurationWithPayloadDTO(outboundConfiguration,payload,dataTypeForPayload);
        String dtoAsJsonString = new ObjectMapper().writeValueAsString(dto);
        outboundStorageMessageProducer.sendBody(dtoAsJsonString);

    }
View Full Code Here

TOP

Related Classes of com.streamreduce.core.model.dto.OutboundConfigurationWithPayloadDTO

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.