I have a JAX-RS webservice deployed on Apache CXF inside of Apache ServiceMix 4 that, upon validating the incoming object, will need to send the message to a JMS queue (e.g. ActiveMQ). What is the easiest way to do this from inside of Apache CXF?

I've Googled a bit, and there are a lot of examples for setting up a webservice that goes *straight* into JMS, but I'm looking to sending the message after doing some processing. Here's a code snippet:

    @POST
    @Path("/sendfoo")
    public Response sendfoo(sendfooRequest sendfooRequest)
    {
        logger.debug("[rest] sendfoo called");

logger.debug("[rest] sendfooRequest campaignId " + sendfooRequest.getCampaignId()); logger.debug("[rest] sendfooRequest fooNumber " + sendfooRequest.getFooNumber()); logger.debug("[rest] sendfooRequest messageType " + sendfooRequest.getMessageType());

// TODO: Figure out why this doesn't seem to work the way I'd expect it to. // This is probably something weird with jettison's JSON marshalling that
        //       I don't understand.
        HashMap<String, String> tagHash = sendfooRequest.getTags();
        if (tagHash != null)
        {
            for (String tag : tagHash.keySet())
            {
logger.debug("[rest] sendfooREquest tag " + tag + ", value " + tagHash.get(tag));
            }
        }

// TODO: validate a sendfooRequest. Perhaps have the request object validate itself?
        //if (!sendfooRequest.isValid())
        //{
        //    return Response.status(400).build();
        //}

// TODO: if the sendfooRequest validates, then send it along to the next endpoint; // otherwise, return an HTTP error 400 (Bad Request) and an error response.

        // Return HTTP response 202 Accepted
        return Response.status(202).build();

    }


Basically, I need to know how to send my sendfooRequest object along to JMS/ActiveMQ.


Thanks!
Scott

Reply via email to