09.12.2012 Views

Advanced Queuing - Oracle

Advanced Queuing - Oracle

Advanced Queuing - Oracle

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Deploying the AQ XML Servlet<br />

Mapping the AQ Agent to Database Users<br />

To map an AQ agent to one or more database users, use DBMS_AQADM.ENABLE_<br />

DB_ACCESS. With the ENABLE_DB_ACCESS procedure, you give an AQ agent the<br />

privileges of a particular database user. This allows the agent to access all queues<br />

that are visible to the database users to which the agent is mapped.<br />

Example<br />

Map the AQ Internet agent JOHN to database users OE (overseas shipping) and<br />

CBADM (customer billing administrator).<br />

DBMS_AQADM.ENABLE_DB_ACCESS(agent_name =>’JOHN’, db_username => ’OE’);<br />

DBMS_AQADM.ENABLE_DB_ACCESS(agent_name =>’JOHN’, db_username => ’CBADM’);<br />

Database Sessions<br />

When the user sends a POST request to the servlet, the servlet parses the request to<br />

determine which queue/topic the user is trying to access. Accordingly, the AQ<br />

servlet creates a database session as one of the database users (db_user) that<br />

maps to the AQ agent. The db_user selected has privileges to access the queue<br />

specified in the request.<br />

Example<br />

AQ agent JOHN sends an enqueue request to OE.OE_NEW_ORDERS_QUE. The<br />

servlet sees that JOHN can map to db_users OE and CBADM. Since OE.OE_NEW_<br />

ORDERS_QUE is in the OE schema, it does a CREATE SESSION as OE to perform<br />

the requested operation.<br />

The AQ servlet creates a connection pool to the <strong>Oracle</strong> server using the AQ servlet<br />

super-user. This super-user creates sessions on behalf of db_users that the<br />

AQ Internet agent maps to. Hence the super-user must have privileges to create<br />

proxy sessions for all the users specified in the ENABLE_DB_ACCESS call. See<br />

"Creating the AQ XML Servlet Class" on page 17-49 for how to create the AQ servlet<br />

super-user.<br />

The AQ servlet super-user can be granted CREATE PROXY session privileges as<br />

follows:<br />

connect sys/change_on_install as sysdba<br />

rem grant super-user AQADM privileges to create proxy sessions as OE<br />

alter user OE grant CONNECT THROUGH AQADM;<br />

rem grant super-user AQADM privileges to create proxy sessions as CBADM<br />

alter user CBADM grant CONNECT THROUGH AQADM;<br />

Internet Access to <strong>Advanced</strong> <strong>Queuing</strong> 17-53

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!