LrJposChannel.setConfiguration

Sets the configuration for the channel.

public static void setConfiguration(Configuration cfg)

Parameters

  • cfg: Instance of org.jpos.core.Configuration that represents the new configuration for the channel.

Return values

This function does not return any values.

Example

Copy code
public void simpleISOtest_config() throws Throwable{
        
        GenericPackager packager = new GenericPackager(PACKAGERCONFIGFILE);
        LrJposChannel.initChannel(LrJposChannel.ChannelType.ASCIIChannel);
        LrJposChannel.setPackager(packager);
        
        Properties props = new Properties();
        props.put("host","localhost");        
        props.put("port", "8000");        
        
        LrJposChannel.setConfiguration(new SimpleConfiguration(props));
        
        LrJposChannel.connect();
        
        LrISOMsg m = new LrISOMsg();
        m.setMTI("0100");
        m.set(ISO87Fields.PAN_PRIMARY_ACCOUNT_NUMBER, "1234567890000000000")
        m.set(3, "523456")
        m.set(4, "123456789121")
        m.set(12, "20241605108110");  
        m.set(47, "32432")

        LrJposChannel.send(m);
        
        LrISOMsg r = LrJposChannel.receive();
        if (r!=null) {
            lr.output_message(r.getMTI());
        }
        
        Configuration cfg = LrJposChannel.getConfiguration();
        
        LrJposChannel.disconnect();
        LrJposChannel.closeChannel();
}