如何解决如何使用 Qpid Proton Python 显式确认或取消确认消息
我有一个 Qpid Proton Python MessageHandler
接收一些触发一些处理的消息。如果处理失败,我如何拒绝消息?至于I can tell from the API documentation,默认为auto_accept=True
。但是,将其更改为 False
似乎并不能避免确认消息,因为后续接收器无法赶上失败的消息。
解决方法
如果您禁用自动接受,则明确接受或拒绝消息是您的责任。如果两者都不做,消息就会陷入困境。
以下是执行显式确认的应用程序代码示例:
private static final String TAG = "verify";
String Name;
String Email;
private String verifytext1;
private String verifytext2;
private String verifytext3;
private String verifytext4;
private String verifytextausruf;
private TextView verifytextview;
private TextView verifytextview2;
private Button repeatsend;
public static void display(FragmentManager fragmentManager) {
accountverify accountVerify = new accountverify();
accountVerify.show(fragmentManager,TAG);
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle arg = getArguments();
if (arg!=null){
Name = arg.getString("userName");
Email = arg.getString("email");
}
verifytext1= getString(R.string.verifytext1);
verifytextausruf= getString(R.string.ausruf);
verifytext2= getString(R.string.verifytext2);
verifytext3= getString(R.string.verifytext3);
verifytext4= getString(R.string.verifytext4);
}
@Override
public View onCreateView(LayoutInflater inflater,@Nullable ViewGroup container,@Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_accountverify,container,false);
verifytextview = view.findViewById(R.id.verifytext);
verifytextview2 = view.findViewById(R.id.verifytext2);
if(Name!=null && Email!= null){
verifytextview.setText(verifytext1+Name+verifytextausruf+verifytext2+Email+verifytext3);
}
else verifytextview.setText(
"Vielen Dank für deine Registrierung und herzlich Willkommen! Dein NightStar Account wurde so eben erstellt. Um deinen Account zu verifizieren,bitten wir dich mit dem Bestätigungslink in der E-Mail,die wir Dir geschickt haben deinen Account zu bestätigen.");
verifytextview2.setText(verifytext4);
Button closebutton = view.findViewById(R.id.verify_exit);
closebutton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
return view;
}
@Override
public void onStart() {
super.onStart();
Dialog dialog = getDialog();
if (dialog != null) {
int width = ViewGroup.MarginLayoutParams.MATCH_PARENT;
int height = ViewGroup.LayoutParams.MATCH_PARENT;
dialog.getWindow().setLayout(width,height);
ColorDrawable back = new ColorDrawable(Color.TRANSPARENT);
InsetDrawable inset = new InsetDrawable(back,60,-10);
dialog.getWindow().setBackgroundDrawable(inset);
dialog.getWindow().setWindowAnimations(R.style.AppTheme_Slide);
}
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。