我正在为Java应用程序配置AMQ代理。用户和角色在其各自的配置属性文件中定义。这些用户具有特定的权限,具体取决于他们尝试使用的地址。
所有这些都在broker.xml中配置。代理使用3个地址:genericTopic,news.europe.europeTopic,news.us.usTopic。对于通用主题地址,所有用户都具有所有权限。
不过,我遇到了这个异常:
import { Pipe, PipeTransform } from '@angular/core';
import { Http, ResponseContentType } from '@angular/http';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/of';
@Pipe({
name: 'secure'
})
export class SecurePipe implements PipeTransform {
constructor(private http: Http, private sanitizer: DomSanitizer) { }
transform(url): Observable<SafeUrl> {
if (//myboolcondition) {
return this.http
.get(url, { responseType: ResponseContentType.Blob })
.catch(err => Observable.throw(err))
.map(val => this.sanitizer.bypassSecurityTrustUrl(URL.createObjectURL(val)));
}
else {
// This is not working and the image src are blank
// My goal in this else loop is just to return what was there originally // in [src]="myobject?.URL in selector
return Observable.of(url);
}
}
}
broker.xml文件包含:
@Component({
selector: 'some-selector',
templateUrl: ['./'],
stylesUrl: ['./'],
providers:[ WebapiService, ContactProviderService ]
})
artemis-users.properties
An exception occured while executing the Java class. AMQ119213: User: bill does not have permission='CREATE_NON_DURABLE_QUEUE' for queue 576bc5ef-3373-409b-b45d-0b382107f915 on address genericTopic
artemis-roles.properties
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-server.xsd">
<core xmlns="urn:activemq:core">
<bindings-directory>./data/messaging/bindings</bindings-directory>
<journal-directory>./data/messaging/journal</journal-directory>
<large-messages-directory>./data/messaging/largemessages</large-messages-directory>
<paging-directory>./data/messaging/paging</paging-directory>
<!-- Acceptors -->
<acceptors>
<acceptor name="netty-acceptor">tcp://localhost:61616</acceptor>
</acceptors>
<!-- Other config -->
<security-settings>
<!-- any user can have full control of generic topics -->
<security-setting match="#">
<permission roles="user" type="createDurableQueue"/>
<permission roles="user" type="deleteDurableQueue"/>
<permission roles="user" type="createNonDurableQueue"/>
<permission roles="user" type="deleteNonDurableQueue"/>
<permission roles="user" type="send"/>
<permission roles="user" type="consume"/>
</security-setting>
<security-setting match="news.europe.#">
<permission roles="user" type="createDurableQueue"/>
<permission roles="user" type="deleteDurableQueue"/>
<permission roles="user" type="createNonDurableQueue"/>
<permission roles="user" type="deleteNonDurableQueue"/>
<permission roles="europe-user" type="send"/>
<permission roles="news-user" type="consume"/>
</security-setting>
<security-setting match="news.us.#">
<permission roles="user" type="createDurableQueue"/>
<permission roles="user" type="deleteDurableQueue"/>
<permission roles="user" type="createNonDurableQueue"/>
<permission roles="user" type="deleteNonDurableQueue"/>
<permission roles="us-user" type="send"/>
<permission roles="news-user" type="consume"/>
</security-setting>
<security-setting match="jms.tempqueue.#">
<permission roles="user" type="createDurableQueue"/>
<permission roles="user" type="deleteDurableQueue"/>
<permission roles="user" type="createNonDurableQueue"/>
<permission roles="user" type="deleteNonDurableQueue"/>
<permission roles="user" type="send"/>
<permission roles="user" type="consume"/>
</security-setting>
</security-settings>
<addresses>
<address name="genericTopic">
<multicast/>
</address>
<address name="news.europe.europeTopic">
<multicast/>
</address>
<address name="news.us.usTopic">
<multicast/>
</address>
</addresses>
</core>
</configuration>
在Java中,用户bill = ENC(1024:020FEC8DB7EBBCB987FD25F1188EA71FA13FD4E0BF504963891EDC97E1ED1285:3E53D34A96F9995612C7C585CA04BA63CF5F531C92510E882960F848BFC3982AF47FCD40AB888F9AC10648CCEBA1DD52C0F0A312B2C90225D9A46DDC50198B3C)
andrew = ENC(1024:3E09F4D16A6970F3C40E24784AFE64AFD66349174AB20B2609109646A8F0561F:F22063143058EBCF47A0ACA1C29DBCB82C4AF15E510F5C801B47928AEA1836D1480BFD0DFD0320BA567D1A32C98859C02350AE271DC530F29D7E16E910E251AD)
frank = ENC(1024:49292EEC8AA19AB5390A0F0D67AA5A3978DE1AF0F561B641A1CE90B3C9637AAD:22A8F9A4B144B9CC173F3B1D5A2B09FE57642234534C2EB3A805DB7D5F7FEA398B58EB9380B8EA69B916B5CFA23BC7573E09A87A20C0DF1A35A1134270260BE4)
sam = ENC(1024:39832F10D9734D7E6EECE16BCEAA5E2917D384B4CE482A2A4B3D3E7A550B0A5C:CCA47914C6DD64AE6B69FE977BB445CBCDEA50D458E7F42AA341FA84A11C302E2EAB072E57B41A636589C89246911A6A49424CBA4B629F4846826183E9AD9DA1)
可以使用提供的密码进行身份验证,我可以使用用户user=bill,andrew,frank,sam
europe-user=andrew
news-user=frank,sam
us-user=frank
为bill
创建生产者,但不能为genericTopic
创建生产者。
这是导致异常的Java代码行:
bill
以下是AMQ代理中的一些附加日志:
MessageConsumer
更新: 我解决了部分问题。我所有的密码都不正确。现在没有例外了,但是消息使用方阻止并永远等待一条存在的消息(已在Web控制台上检查该消息),但是由于某种原因它无法接收。另外,我仍然收到有关客户端连接失败的警告。 更具体地说,应用程序在此处停止:
MessageConsumer consumer = session.createConsumer(topic);