Package com.taobao.metamorphosis.client.producer

Examples of com.taobao.metamorphosis.client.producer.XAMessageProducer


        return xads.getXAConnection();
    }


    public Object executeCallback(final XACallback callback) {
        XAMessageProducer producer = null;
        XAConnection conn = null;
        Transaction tx = null;
        Connection sqlConn = null;
        try {
            this.init();
View Full Code Here


    public void xaTxSendMessage_nProducer(final int count, final String strdata, final String topic, final int num)
            throws Exception {
        this.messages = new ArrayList<Message>();
        for (int j = 0; j < num; j++) {
            // ��Ҫ����topic
            final XAMessageProducer messageProducer = (XAMessageProducer) this.producerList.get(j);
            messageProducer.publish(topic);

            for (int i = 0; i < count; i++) {
                final byte[] data = ("hello" + j + i).getBytes();
                final Message msg = new Message(topic, data);
                final XAResource xares = messageProducer.getXAResource();
                final Xid xid =
                        XIDGenerator.createXID(this.formatIdIdGenerator.incrementAndGet(), this.UNIQUE_QUALIFIER);
                xares.start(xid, XAResource.TMNOFLAGS);
                final SendResult result = messageProducer.sendMessage(msg);
                if (!result.isSuccess() || i % 2 == 0) {
                    xares.end(xid, XAResource.TMFAIL);
                    xares.rollback(xid);
                }
                else {
View Full Code Here

        final TransactionManager tm = new UserTransactionManager();

        final String topic = "meta-test";
        final XAMessageSessionFactory xasf = getXAMessageSessionFactory();
        // create XA producer,it should be used as a singleton instance.
        XAMessageProducer xaMessageProducer = xasf.createXAProducer();
        // publish topic
        xaMessageProducer.publish(topic);
        // create XA datasource,reuse it.
        final XADataSource xads = getXADataSource();

        final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = null;
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.client.producer.XAMessageProducer

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.