camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vcheruvu <v_cher...@hotmail.com>
Subject Re: Quickfix component as initiator - How do I insert user and password to logon
Date Wed, 06 Feb 2013 22:00:40 GMT
Hi,

We have used login in our application. Example listed below using JAVA DSL.
You will have to create another route that consumes Admin messages from
quickfix engine and set credential injector. After that you can use 
"to("quickfix:receptor.cfg")" in any route to publish your fix message

	
from("quickfix:META-INF/quickfix/session.cfg?sessionID=FIX.4.2:SenderCompID->TargetCompID").filter(
				PredicateBuilder.and(
						header(QuickfixjEndpoint.EVENT_CATEGORY_KEY).isEqualTo(
								QuickfixjEventCategory.AdminMessageSent),
						header(QuickfixjEndpoint.MESSAGE_TYPE_KEY).isEqualTo(
								MsgType.LOGON)))
			.bean(new CredentialInjector("password123"));




	public static class CredentialInjector {
		private final String password;

		public CredentialInjector(String password) {
			this.password = password;
		}

		public void inject(Exchange exchange) throws InvalidPayloadException {
			System.out.println("Injecting password into outgoing logon message");
			Message message = ExchangeHelper.getMandatoryInBody(exchange,
					Message.class);
			message.setString(553, "username");
			message.setString(RawData.FIELD, password);
			message.setInt(RawDataLength.FIELD, password.length());
		}
	}

Let me know if it works for you.. Camel rocks!!



Cheers,
-Vid-







--
View this message in context: http://camel.465427.n5.nabble.com/Quickfix-component-as-initiator-How-do-I-insert-user-and-password-to-logon-tp5726991p5727056.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message