根据文件夹内容暂停apache camel路由(Suspending an apache camel route depending of a folder content)
我想在apache camel java app中解码这个逻辑:ReadFromActiveMq文件并将它们发送到直接路由DirectRoute而existsFilesInFolder {retrytoLoadThemForever()//虽然出现错误 - >需要手动操作}消耗DirectRoute消息。
在java我有这个:
onManualDataReceivedException().maximumRedeliveries(-1) from("file:" + recoverableErrorsFolder +"?noop=true").to("bean:processManualFilesDatabean"); //If there is an error in manual process i throw ManualDataReceivedException from ("direct:DirectRoute") .to("bean:processDirectQueueBean"); private OnExceptionDefinition onManualDataReceivedException() { return onException(ManualDataReceivedException.class); }
如何直接暂停:如果recoverableErrorsFolder文件夹中有文件,DirectRoute消耗?
I would like to decode this logic in an apache camel java app: ReadFromActiveMq files and send them to direct route DirectRoute While existsFilesInFolder { retrytoLoadThemForever() //although errors appears --> manual action required } consume DirectRoute messages.
In java i have this made:
onManualDataReceivedException().maximumRedeliveries(-1) from("file:" + recoverableErrorsFolder +"?noop=true").to("bean:processManualFilesDatabean"); //If there is an error in manual process i throw ManualDataReceivedException from ("direct:DirectRoute") .to("bean:processDirectQueueBean"); private OnExceptionDefinition onManualDataReceivedException() { return onException(ManualDataReceivedException.class); }
How can i pause direct:DirectRoute consumption if there are files in recoverableErrorsFolder folder?
原文:https://stackoverflow.com/questions/44801541
最满意答案
您可以在标签中添加“假”标签:
<ion-tabs class="tabs-royal tabs-striped"> <ion-tab title="A" href="#/tab/a"> <ion-nav-view name="a-tab"></ion-nav-view> </ion-tab> <ion-tab title="B" href="#/tab/b"> <ion-nav-view name="b-tab"></ion-nav-view> </ion-tab> <ion-tab title="C" href="#/tab/c"> <ion-nav-view name="c-tab"></ion-nav-view> </ion-tab> <ion-tab title="D" ng-click="openMyModal()"> </ion-tab> </ion-tabs>
如您所见,最后一个是空的:
<ion-tab title="D" ng-click="openMyModal()"> </ion-tab>
我们点击选项卡(ng-click),它调用方法
openMyModal
。由于我没有为该选项卡定义控制器,因此我将使用控制器作为抽象选项卡:
.state('tab', { url: '/tab', abstract: true, templateUrl: 'tabs.html', controller: 'TabsController' })
这将是控制器TabsController:
.controller('TabsController', function($scope, $ionicModal){ $scope.modal = null; $ionicModal.fromTemplateUrl('my-modal.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.modal = modal; }); $scope.openMyModal = function() { $scope.modal.show(); }; $scope.closeModal = function() { $scope.modal.hide(); }; })
如果你想看到它的实际效果,请检查这个plunker 。
You can add a "fake" tab to your tabs:
<ion-tabs class="tabs-royal tabs-striped"> <ion-tab title="A" href="#/tab/a"> <ion-nav-view name="a-tab"></ion-nav-view> </ion-tab> <ion-tab title="B" href="#/tab/b"> <ion-nav-view name="b-tab"></ion-nav-view> </ion-tab> <ion-tab title="C" href="#/tab/c"> <ion-nav-view name="c-tab"></ion-nav-view> </ion-tab> <ion-tab title="D" ng-click="openMyModal()"> </ion-tab> </ion-tabs>
As you can see the last one is empty:
<ion-tab title="D" ng-click="openMyModal()"> </ion-tab>
We you click to the tab (ng-click) it calls a method
openMyModal
.Since I haven't defined a controller for that tab I am going to use the controller for the abstract tabs:
.state('tab', { url: '/tab', abstract: true, templateUrl: 'tabs.html', controller: 'TabsController' })
and this would be the controller TabsController:
.controller('TabsController', function($scope, $ionicModal){ $scope.modal = null; $ionicModal.fromTemplateUrl('my-modal.html', { scope: $scope, animation: 'slide-in-up' }).then(function(modal) { $scope.modal = modal; }); $scope.openMyModal = function() { $scope.modal.show(); }; $scope.closeModal = function() { $scope.modal.hide(); }; })
If you want to see it in action check this plunker.
相关问答
更多-
离子莫代尔与路线无关。 您只需从服务器加载一个静态html模板,并且使用所有绑定以离子模式显示相同的html。 不要声明单独的控制器,而要将其移入同一控制器中: app.controller('hashtagController', ['$scope', function($scope, $ionicModal) { $scope.hashtag = function() { $scope.hashtagValue = 'blackandwhitephotography'; // i ...
-
如果您的modal.html存储在templates文件夹中,您可以尝试添加templates/或任何路径: $ionicModal.fromTemplateUrl('templates/modal.html', { If your modal.html is stored in a templates folder, can you try adding templates/ or whatever the path is: $ionicModal.fromTemplateUrl('templates/ ...
-
由于fromTemplateUrl返回一个承诺, $scope.showTypeOfTest(); $scope.openModal(); 将不起作用,因为modal没有被定义,因为$scope.modal = modal; 还没有叫。 建议:重构链接诺言: showTypeOfTest = function() { return $ionicModal.fromTemplateUrl('templates/type-of-test.html', { scope: $scope, ...
-
从离子弹出中打开离子模态(Open ionic modal from ionic popup)[2023-07-02]
使用AngularJS Service设置控制器之间的通信 阅读: 与角度js中的控制器通信 您的服务可能如下所示: function ServiceName(){ var serviceFunction; return { set: function(funcFromCtrl){ serviceFunction = funcFromCtrl; }, call: function(){ serv ... -
离子模态出现在负载上(Ionic Modal Appear on load)[2021-12-13]
加: $scope.modal.show(); 控制器中的某个位置,在定义了$scope.modal值之后。 Add: $scope.modal.show(); Somewhere in your controller, after the $scope.modal value has been defined. -
好的,我通过观看视频AngularJS解决了我的问题- 在控制器之间进行通信 。 总之,我创建了一个注入控制器的共享服务。 然后,控制器使用该服务在控制器之间广播/处理消息。 以下是相关代码: Controllers.js angular.module('starter.controllers', []) .controller('FriendsCtrl', function ($scope, $window, TodoList, GroupService) { $scope.openModal ...
-
我找到了临时解决方案。 我编辑了ionic.css文件 .popup-open { pointer-events: none; } to .popup-open { pointer-events: auto; } I have found temporary solution for this. I have edited ionic.css file .popup-open { pointer-events: none; } to .popup-open { pointer ...
-
您可以在标签中添加“假”标签:
... -
离子无法显示模态(Ionic unable to showing modal)[2021-10-10]
问题是您将控制器连接到的视图,并且之前创建了按钮,因此它不起作用。 您必须在创建按钮之前添加ng-controller="ToDoListCtrl" 。 The problem is that you attach your controller to the view in the and the button is created before, so it doesn't work. You have to add ng-controller="ToDoLis ... -
将数据链接到范围变量后,可以使用AngularJS指令ng-repeat来浏览JSON数据。 如果您使用服务或其他内容,则选择可以在绑定到范围变量后自动更新。 我做了一个小代码来向您展示:codepen.io/akyh/pen/rBpAy?editors=101154当您单击上方按钮时,它会向我的JSON数据添加一个元素,并在视图中自动刷新。 我希望这就是你要找的东西。 You can use the AngularJS directive ng-repeat to go through your JSON ...