Examples of ISOChannel


Examples of org.jpos.iso.ISOChannel

    }

    @Test
    public void testFilter2() throws Throwable {
        DelayFilter delayFilter = new DelayFilter(-1);
        ISOChannel channel = new PADChannel(new CTCSubFieldPackager());
        LogEvent evt = new LogEvent("testDelayFilterTag", "");
        ISOMsg result = delayFilter.filter(channel, m, evt);
        assertEquals("evt.payLoad.size()", 2, evt.getPayLoad().size());
        assertEquals("evt.payLoad.get(1)", "<delay-filter delay=\"-1\"/>", evt.getPayLoad().get(1));
        assertSame("result", m, result);
View Full Code Here

Examples of org.jpos.iso.ISOChannel

        LogEvent evt = new LogEvent (this, "connect");
        evt.addMessage ("pool-size=" + Integer.toString (pool.size()));
        for (int i=0; i<pool.size(); i++) {
            try {
                evt.addMessage ("pool-" + Integer.toString (i));
                ISOChannel c = (ISOChannel) pool.get (i);
                c.connect ();
                if (c.isConnected()) {
                    current = c;
                    usable = true;
                    break;
                }
            } catch (IOException e) {
View Full Code Here

Examples of org.jpos.iso.ISOChannel

    public synchronized void disconnect () throws IOException {
        current = null;
        LogEvent evt = new LogEvent (this, "disconnect");
        for (Object aPool : pool) {
            try {
                ISOChannel c = (ISOChannel) aPool;
                c.disconnect();
            } catch (IOException e) {
                evt.addMessage(e);
            }
        }
        Logger.log (evt);
View Full Code Here

Examples of org.jpos.iso.ISOChannel

            throw new ConfigurationException("class attribute missing from channel element.");
        }

        String packagerName = e.getAttributeValue("packager");

        ISOChannel channel = (ISOChannel) f.newInstance(channelName);
        ISOPackager packager;
        if (packagerName != null)
        {
            packager = (ISOPackager) f.newInstance(packagerName);
            channel.setPackager(packager);
            f.setConfiguration(packager, e);
        }
        QFactory.invoke(channel, "setHeader", e.getAttributeValue("header"));
        f.setLogger(channel, e);
        f.setConfiguration(channel, e);
View Full Code Here

Examples of org.jpos.iso.ISOChannel

        private boolean isChannelConnectable(boolean showExceptions)
        {
            boolean res = false;

            ISOChannel channel = null;
            try
            {
                channel = newChannel(channelElement, getFactory());
                if (channel instanceof BaseChannel)
                {
                    BaseChannel bc = (BaseChannel) channel;
                    bc.setLogger(null, null);
                }
                channel.connect();
                res = true;
            }
            catch (Exception e)
            {
                if (showExceptions)
                {
                    getLog().error(e.getMessage());
                }
            }
            finally
            {
                if (channel != null && channel.isConnected())
                {
                    try
                    {
                        channel.disconnect();
                    }
                    catch (IOException e)
                    {
                    }
                }
View Full Code Here

Examples of org.jpos.iso.ISOChannel

        }

        public void run()
        {
            Thread.currentThread().setName("channel-worker-" + id);
            ISOChannel channel = null;

            try
            {
                channel = newChannel(channelElement, getFactory());
                if (getName() != null)
                {
                    channel.setName(getName() + id);
                }

                ISOMsg handBack = null;
                if (handbackFields.length > 0)
                {
                    handBack = (ISOMsg) req.clone(handbackFields);
                }
                try
                {
                    channel.connect();
                }
                catch (Throwable e)
                {
                    takeOffline();
                }
                if (channel.isConnected())
                {
                    takeOnline();
                    channel.send(req);
                    ISOMsg rsp = channel.receive();
                    channel.disconnect();
                    if (handBack != null)
                    {
                        rsp.merge(handBack);
                    }
                    sp.out(out, rsp);
                }
            }
            catch (Exception e)
            {
                getLog().warn("channel-worker-" + id, e.getMessage());
            }
            finally
            {
                try
                {
                    if (channel != null)
                    {
                        channel.disconnect();
                    }
                }
                catch (Exception e)
                {
                    getLog().warn("channel-worker-" + id, e.getMessage());
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.