Examples of MessageImpl


Examples of org.apache.qpid.proton.message.impl.MessageImpl

               SimpleString value = (SimpleString) typedProperties.getProperty(propertyName);
               Symbol symbol = Symbol.getSymbol(realName.replace(MESSAGE_ANNOTATIONS, ""));
               messageAnnotations.getValue().put(symbol, value.toString());
            }
         }
         MessageImpl protonMessage = new MessageImpl(header, deliveryAnnotations, messageAnnotations, props, applicationProperties, section, footer);
         protonMessage.setMessageFormat(getMessageFormat(message.getLongProperty(new SimpleString(PROTON_MESSAGE_FORMAT))));
         ByteBuffer buffer = ByteBuffer.wrap(new byte[size]);
         final DroppingWritableBuffer overflow = new DroppingWritableBuffer();
         int c = protonMessage.encode(new CompositeWritableBuffer(new WritableBuffer.ByteBufferWrapper(buffer), overflow));
         if (overflow.position() > 0)
         {
            buffer = ByteBuffer.wrap(new byte[1024 * 4 + overflow.position()]);
            c = protonMessage.encode(new WritableBuffer.ByteBufferWrapper(buffer));
         }

         return new EncodedMessage(messageFormat, buffer.array(), 0, c);
      }
View Full Code Here

Examples of org.apache.servicemix.nmr.core.MessageImpl

    public Set getPropertyNames() {
        return exchange.getProperties().keySet();
    }

    public NormalizedMessage createMessage() throws MessagingException {
        return new NormalizedMessageImpl(new MessageImpl());
    }
View Full Code Here

Examples of org.apache.servicemix.soap.core.MessageImpl

public class StaxInInterceptorTest extends TestCase {

    private StaxInInterceptor interceptor = new StaxInInterceptor();
   
    public void testNullInput() {
        Message msg = new MessageImpl();
        interceptor.handleMessage(msg);
        assertNull(msg.getContent(XMLStreamReader.class));
    }
View Full Code Here

Examples of org.apache.shindig.social.core.model.MessageImpl

    registry.addHandlers(ImmutableSet.<Object>of(handler));
  }

  @Test
  public void testPostMessage() throws Exception {
    MessageImpl message = new MessageImpl("A message body", "A title", Message.Type.PRIVATE_MESSAGE);
    message.setRecipients(recipients);

    EasyMock.expect(converter.convertToObject(null, Message.class)).andReturn(message);
    EasyMock.expect(messageService.createMessage(sender, "messageHandlerTest", "@outbox", message,
        token)).andReturn(ImmediateFuture.newInstance((Void) null));
View Full Code Here

Examples of org.apache.tomcat.bayeux.MessageImpl

                                           (ClientImpl)event.getHttpServletRequest().getAttribute("client");
        boolean success = false;
        HttpError error = validate();
        if (error == null) {
            ChannelImpl chimpl = (ChannelImpl)getTomcatBayeux().getChannel(channel,false);
            MessageImpl mimpl = (MessageImpl)getTomcatBayeux().newMessage(client);
           
            try {
                String[] keys = JSONObject.getNames(msgData);
                for (int i = 0; i < keys.length; i++) {
                    mimpl.put(keys[i], msgData.get(keys[i]));
                }
                success = true;
                ((HashMap) response.get(Bayeux.ADVICE_FIELD)).put(Bayeux.RECONNECT_FIELD, Bayeux.RETRY_RESPONSE);
                ((HashMap) response.get(Bayeux.ADVICE_FIELD)).put(Bayeux.INTERVAL_FIELD, getReconnectInterval());
            }catch (JSONException x) {
View Full Code Here

Examples of org.apache.tuscany.sca.core.invocation.MessageImpl

            throw new RuntimeException(e);
        }
    }
   
    protected void invoke(InvocationChain chain, Object[] args) {
        Message msg = new MessageImpl();
        msg.setBody(args);
        chain.getHeadInvoker().invoke(msg);
    }
View Full Code Here

Examples of org.apache.tuscany.sca.core.invocation.impl.MessageImpl

    }

    public void invokeAsync(WebsocketBindingMessage request, TuscanyWebsocket channel) {
        String jsonParams = request.getPayload();
        Object[] args = JSONUtil.decodePayloadForOperation(jsonParams, operation);
        Message msg = new MessageImpl();
        msg.getHeaders().put(Constants.MESSAGE_ID, channel.getId());
        msg.setBody(args);
        EndpointReference re = new RuntimeEndpointReferenceImpl();
        RuntimeEndpointImpl callbackEndpoint = new RuntimeEndpointImpl();
        callbackEndpoint.setURI(request.getOperation());
        re.setCallbackEndpoint(callbackEndpoint);
        msg.setFrom(re);
        endpoint.invoke(operation, msg);
    }
View Full Code Here

Examples of org.apache.tuscany.spi.wire.MessageImpl

                        args[i] = is.readObject();
                    }
                    Map<Operation<?>, InboundInvocationChain> chains = getInboundWire().getInvocationChains();
                    for (InboundInvocationChain chain : chains.values()) {
                        if (chain.getOperation().getName().equals(operation)) {
                            Message message = new MessageImpl();
                            message.setTargetInvoker(chain.getTargetInvoker());
                            message.setBody(args);
                            message = chain.getHeadInterceptor().invoke(message);
                            os = new ObjectOutputStream(clientSocket.getOutputStream());
                            os.writeObject(message.getBody());
                            os.flush();
                        }
                    }
                } catch (IOException e) {
                    throw new TestBindingRuntimeException(e);
View Full Code Here

Examples of org.cometd.server.MessageImpl

                }

                final int size = messages.size();
                for (int i = 0; i < size; i++) {
                    final Message message = messages.get(i);
                    final MessageImpl mesgImpl = (message instanceof MessageImpl) ? (MessageImpl) message : null;

                    // Can we short cut the message?
                    if (i == 0 && size == 1 && mesgImpl != null && _refsThreshold > 0 && metaConnectReply != null && transport instanceof JSONTransport) {
                        // is there a response already prepared
                        ByteBuffer buffer = mesgImpl.getBuffer();
                        if (buffer != null) {
                            // Send pre-prepared buffer
                            request.setAttribute("org.mortbay.jetty.ResponseBuffer", buffer);
                            if (metaConnectReply instanceof MessageImpl)
                                ((MessageImpl) metaConnectReply).decRef();
                            metaConnectReply = null;
                            transport = null;
                            mesgImpl.decRef();
                            continue;
                        } else if (mesgImpl.getRefs() >= _refsThreshold) {
                            // create multi-use buffer
                            byte[] contentBytes = ("[" + mesgImpl.getJSON() + ",{\"" + Bayeux.SUCCESSFUL_FIELD + "\":true,\"" + Bayeux.CHANNEL_FIELD
                                    + "\":\"" + Bayeux.META_CONNECT + "\"}]").getBytes(StringUtil.__UTF8);
                            int contentLength = contentBytes.length;

                            String headerString = "HTTP/1.1 200 OK\r\n" + "Content-Type: text/json; charset=utf-8\r\n" + "Content-Length: "
                                    + contentLength + "\r\n" + "\r\n";

                            byte[] headerBytes = headerString.getBytes(StringUtil.__UTF8);

                            buffer = ByteBuffer.allocateDirect(headerBytes.length + contentLength);
                            buffer.put(headerBytes);
                            buffer.put(contentBytes);
                            buffer.flip();

                            mesgImpl.setBuffer(buffer);
                            request.setAttribute("org.mortbay.jetty.ResponseBuffer", buffer);
                            metaConnectReply = null;
                            if (metaConnectReply instanceof MessageImpl)
                                ((MessageImpl) metaConnectReply).decRef();
                            transport = null;
                            mesgImpl.decRef();
                            continue;
                        }
                    }

                    if (message != null)
                        transport.send(message);
                    if (mesgImpl != null)
                        mesgImpl.decRef();
                }

                if (metaConnectReply != null) {
                    metaConnectReply = _bayeux.extendSendMeta(client, metaConnectReply);
                    transport.send(metaConnectReply);
View Full Code Here

Examples of org.exolab.jms.message.MessageImpl

        }

        while (iterator.hasNext()) {
            MessageState state = (MessageState) iterator.next();
            MessageImpl message = adapter.getMessage(connection,
                                                     state.getMessageId());
            PersistentMessageHandle handle =
                    new PersistentMessageHandle(message.getJMSMessageID(),
                                                message.getJMSPriority(),
                                                message.getAcceptedTime(),
                                                message.getSequenceNumber(),
                                                message.getJMSExpiration(),
                                                destination,
                                                name);
            handle.setDelivered(state.getDelivered());
            handle.add();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.