/** * Constructor. * @param reconfigurable * @param messagingProperties */ protected RabbitMqClient( ReconfigurableClient<?> reconfigurable, Map<String,String> messagingProperties ) { this( reconfigurable, messagingProperties, reconfigurable.getOwnerKind()); }
@Override public void openConnection() throws IOException { openConnection( getMessagingClient()); }
/** * @return a new reconfigurable (messaging) client for the agent */ protected ReconfigurableClientAgent newReconfigurableClientAgent() { return new ReconfigurableClientAgent(); }
@Test public void testInvalidFactory_agent() throws Exception { // The internal client will be null. // But still, there will be no NPE or other exception. ReconfigurableClientAgent client = new ReconfigurableClientAgent(); client.setApplicationName( "app" ); client.setScopedInstancePath( "/root" ); client.switchMessagingType( null ); client.openConnection(); }
@Override public void listenToTheDm( ListenerCommand command ) throws IOException { listenToTheDm( getMessagingClient(), command ); }
@Override public void listenToAgentMessages( Application application, ListenerCommand command ) throws IOException { listenToAgentMessages( getMessagingClient(), application, command ); }
/** * Constructor. */ protected ReconfigurableClient() { resetInternalClient(); // Try to find the MessagingClientFactoryRegistry service. setRegistry( lookupMessagingClientFactoryRegistryService( new OsgiHelper())); }
@Override public void setApplicationName( String applicationName ) { this.applicationName = applicationName; // Propagate the information to the internal client. getMessagingClient().setOwnerProperties( getOwnerKind(), this.domain, applicationName, this.scopedInstancePath ); }
@Override public void closeConnection() throws IOException { final IMessagingClient toClose = resetInternalClient(); if (toClose != null) toClose.closeConnection(); }
@Override public void closeConnection() throws IOException { final IMessagingClient toClose = resetInternalClient(); if (toClose != null) toClose.closeConnection(); }
/** * @return true if this agent needs the DM to send its model */ public boolean needsModel() { AgentMessageProcessor messageProcessor = null; if( this.messagingClient != null ) messageProcessor = (AgentMessageProcessor) this.messagingClient.getMessageProcessor(); return messageProcessor == null || messageProcessor.scopedInstance == null; }
@Override public IMessagingClient createClient( ReconfigurableClient<?> parent ) { return new DummyMessagingClient(this.type); }
@Override public void openConnection() throws IOException { openConnection( getMessagingClient()); }
@Override public void listenToTheDm( ListenerCommand command ) throws IOException { listenToTheDm( getMessagingClient(), command ); }
@Override public void listenToAgentMessages( Application application, ListenerCommand command ) throws IOException { listenToAgentMessages( getMessagingClient(), application, command ); }
/** * Constructor. */ protected ReconfigurableClient() { resetInternalClient(); // Try to find the MessagingClientFactoryRegistry service. setRegistry( lookupMessagingClientFactoryRegistryService( new OsgiHelper())); }
@Override public void setScopedInstancePath( String scopedInstancePath ) { this.scopedInstancePath = scopedInstancePath; // Propagate the information to the internal client. getMessagingClient().setOwnerProperties( getOwnerKind(), this.domain, this.applicationName, scopedInstancePath ); }
@Override public void closeConnection() throws IOException { final IMessagingClient toClose = resetInternalClient(); if (toClose != null) toClose.closeConnection(); }
@Override public void closeConnection() throws IOException { final IMessagingClient toClose = resetInternalClient(); if (toClose != null) toClose.closeConnection(); }
@Override public void setApplicationName( String applicationName ) { this.applicationName = applicationName; // Propagate the information to the internal client. getMessagingClient().setOwnerProperties( getOwnerKind(), this.domain, applicationName, this.scopedInstancePath ); }