Java Code Examples for com.ibm.mq.jms.MQConnectionFactory#setPort()

The following examples show how to use com.ibm.mq.jms.MQConnectionFactory#setPort() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebSphereMQTarget.java    From jmet with MIT License 6 votes vote down vote up
public void init() throws InitException {

        try {
            MQConnectionFactory realfactory = new MQConnectionFactory();
            realfactory.setTransportType(WMQConstants.WMQ_CM_CLIENT);
            realfactory.setHostName(getHost());
            realfactory.setPort(getPort());
            realfactory.setQueueManager(getQueueManager());
            realfactory.setChannel(getChannel());

            factory = realfactory;
            connection = factory.createConnection(getUser(), getPassword());
            session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            dest = (getDestType() == DestType.QUEUE) ? session.createQueue(getDestination()) : session.createTopic(getDestination());
            producer = session.createProducer(dest);
            connection.start();
        } catch (JMSException e) {
            throw new InitException(e.fillInStackTrace());
        }

    }
 
Example 2
Source File: MQCommandProcessor.java    From perf-harness with MIT License 5 votes vote down vote up
/**
 * Apply vendor-specific settings for building up a connection factory to
 * WMQ.
 * 
 * @param cf
 * @throws JMSException
 */
protected void configureMQConnectionFactory(MQConnectionFactory cf)
		throws JMSException {

	// always client bindings
	cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
	cf.setHostName(Config.parms.getString("cmd_jh"));
	cf.setPort(Config.parms.getInt("cmd_p"));
	cf.setChannel(Config.parms.getString("cmd_jc"));

	cf.setQueueManager(Config.parms.getString("cmd_jb"));

}
 
Example 3
Source File: WMB.java    From perf-harness with MIT License 3 votes vote down vote up
/**
 * Provide additional functionality for WMB connection factories.
 */
@SuppressWarnings("deprecation")
private void configureWBIMBConnectionFactory(MQConnectionFactory cf) throws JMSException {

		//Set common attributes i.e. version,port,hostname and buffersize.			
		//Set the broker version we will use version 2 is suitable for argo brokers
		cf.setBrokerVersion(brokerVersion);
		cf.setHostName(Config.parms.getString("jh"));
		cf.setPort(Config.parms.getInt("jp"));
		if (bufferSize > 0)
		{
			cf.setMaxBufferSize(bufferSize);
		}

		if (transport.equals("ip"))
		{
			System.out.println("Using transport type MQJMS_TP_DIRECT_TCPIP");
			cf.setTransportType(WMQConstants.WMQ_CM_DIRECT_TCPIP);
		}
		else if (transport.equals("ipmc"))
		{
			System.out.println("Using transport type MQJMS_TP_DIRECT_TCPIP, Multicast Enabled");
			cf.setTransportType(WMQConstants.WMQ_CM_DIRECT_TCPIP);
			cf.setMulticast(WMQConstants.RTT_MULTICAST_ENABLED);
		}
		else if (transport.equals("ipmcr"))
		{
			System.out.println("Using transport type MQJMS_TP_DIRECT_TCPIP, Multicast Enabled & Reliable");
			cf.setTransportType(WMQConstants.WMQ_CM_DIRECT_TCPIP);
			cf.setMulticast(WMQConstants.RTT_MULTICAST_RELIABLE);
		}
		else if (transport.equals("ipmcn"))
		{
			System.out.println("Using transport type MQJMS_TP_DIRECT_TCPIP, Multicast Enabled & NOT Reliable");
			cf.setTransportType(WMQConstants.WMQ_CM_DIRECT_TCPIP);
			cf.setMulticast(WMQConstants.RTT_MULTICAST_NOT_RELIABLE);
		}
		else if (transport.equals("mqb"))
		{
			//Place holder statement incase we ever need to do anything for this transport over and above what the MQ plugin already does.
			cf.setBrokerQueueManager(Config.parms.getString("jb"));
		}
		else if (transport.equals("mqc"))
		{
			//Place holder statement incase we ever need to do anything for this transport over and above what the MQ plugin already does.
			cf.setBrokerQueueManager(Config.parms.getString("jb"));
		}
		else
		{
			System.out.println("Invalid transport type");
			System.exit(1);
		}
		

}