2016-12-27 6 views
0

J'ai créé un canal de contrôle et un service de passerelle pour envoyer un message de contrôle à ce canal. Cependant, après avoir appelé la méthode de service de passerelle supposée renvoyer boolean, elle ne revient pas après la soumission du message.Spring Integration Gateway Méthode de service ne retournant pas au démarrage/à l'arrêt

Code Snippet:

public interface SampleControlService { 
    boolean sendControl(String message); 
} 

.... 

@Autowired 
private SampleControlService sampleControlService; 

..... 

boolean done = sampleControlService.sendControl("@testAdapter.stop()"); // message gets sent but it is not returning to caller 

System.out.println("Done : " + done); // this line doesn't execute 


// integration config 
<int:channel id="controlChannel"/> 
<int:gateway service-interface="com.test.service.SampleControlService" default-request-channel="controlChannel" /> 
<int:control-bus input-channel="controlChannel"/> 

Cependant, si j'envoie un message @ testAdapter.isRunning() pour vérifier l'état, il revient comme prévu.

Répondre

1

Le puits void stop() ne retourne pas de résultat alors que boolean isRunning() le fait; la passerelle ne sait rien de la méthode appelée; vous «dites» le cadre que vous attendez d'un résultat qui ne viendra jamais.

Vous pouvez ajouter une autre méthode de passerelle

void sendOneWayControl(String command); 

ou ajouter default-reply-timeout="0" à la passerelle et vous obtiendrez un retour null.

+0

merci, ajouté la nouvelle méthode. – zdesam